问题
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