【问题标题】:Amazon Lex's session attributes do not allow nested object?Amazon Lex 的会话属性不允许嵌套对象?
【发布时间】:2017-11-15 20:41:05
【问题描述】:

我试图在sessionAttributes 中保留一个嵌套对象。但是,Amazon Lex 似乎无法识别我是否发送了这样的结构作为响应:

{
    "sessionAttributes": {
        "previousIntent": "TCAIntent",
        "prevSlots": {
            "test": 1
        }
    },
    "dialogAction": {
        "type": "Delegate",
        "slots": {
            "firstName": null,
            "lastName": null,
            "rate": null,
            "rentMortgage": null,
            "downPayment": null,
            "purchasePrice": null,
            "email": null
        }
    }
}

当我用一个值替换 {"test": 1} 时,它工作正常。有没有办法解决这个或可能的错误?

错误:

【问题讨论】:

    标签: json amazon-web-services amazon-lex


    【解决方案1】:

    我发现 Lex 不允许在 sessionAttributes 上存储 json 对象或数组。作为一种解决方法,我将 json 对象转换为字符串,并在需要使用时将其转换回来。

    【讨论】:

    • 谢谢。遇到同样问题的问题
    • 完美!这并没有给我带来错误(至少没有我可以访问的地方),并且花了一周的时间将其缩小到问题/解决方案。
    猜你喜欢
    • 2018-11-27
    • 2021-10-12
    • 2013-04-01
    • 1970-01-01
    • 2017-06-03
    • 2016-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多