本文介绍了Amazon Lex的会话属性不允许嵌套对象吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将嵌套对象保留在sessionAttributes
中.但是,似乎Amazon Lex无法识别我是否发送以下结构作为响应:
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
}
}
}
当我用值替换{"test": 1}
时,它可以正常工作.有没有办法解决这个问题或可能的错误?
When I replace {"test": 1}
with a value, it works fine. Is there a way around this or possible mistake?
错误:
推荐答案
我发现Lex不允许在sessionAttributes
上存储json对象或数组.解决方法是,我将json对象转换为字符串,并在需要使用时将其转换回.
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.
这篇关于Amazon Lex的会话属性不允许嵌套对象吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!