Amazon Lex's session attributes do not allow nested object?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 07:39:09

问题


I am trying to persist a nested object in sessionAttributes. However, it seems Amazon Lex does not recognize if I send a structure like this in response:

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

When I replace {"test": 1} with a value, it works fine. Is there a way around this or possible mistake?

Error:


回答1:


I have figured out that Lex does not allow storing json object or array on sessionAttributes. As a work around, I converted the json object to string and convert it back when I need to use it.



来源:https://stackoverflow.com/questions/44532168/amazon-lexs-session-attributes-do-not-allow-nested-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!