Good afternoon folks,
I have the following Object as a String in variable dfResponse["result"]:
"result": {
"source": "agent",
"resolvedQuery": "set blink pattern to 4",
"action": "SendIotCommand",
"actionIncomplete": false,
"parameters": {
"blinkPattern": "set blink pattern",
"number": 4
},
"contexts": [
{
"name": "patternnumber",
"parameters": {
"number": 4,
"blinkPattern": "set blink pattern",
"number.original": "4",
"blinkPattern.original": "blink pattern"
},
"lifespan": 1
}
],
"metadata": {
"intentId": "1570a9b0-534c-4a5a-bdfd-f433789d7aba",
"webhookUsed": "false",
"webhookForSlotFillingUsed": "false",
"intentName": "setBlinkPattern"
},
"fulfillment": {
"speech": "",
"messages": [
{
"type": 4,
"payload": {
"breeze": {
"userResponse": "Understood - IOT command has ben sent",
"ledSet": "4"
}
}
}
]
},
"score": 1
}
I can extract "action" String using the following:
JSON.parse(dfResponse["result"]).action
I can extract "fulfillment" Object using the following:
JSON.parse(dfResponse["result"]).fulfillment
But I cannot save it as a String as the Expression Editor just highlights the expression in red:
JSON.parse(dfResponse["result"]).fulfillment.toString()
I tried a bunch a variations with the same results. It is very possible that I got the expression incorrect but I think I may have pushed the Expression Editor one step too far.
I am trying to get the "breeze" Object and currently believe that I need to parse an Object out of "result", save it as a String and parse the saved Object again!
It would be easier if I could find an On-Line service into which I could paste my JSON Object and it provides the JSON properties for the Object. I could then use this in my Call REST Service as the Return Schema. I do not have the patience to do this by hand...
Thoughts,
Gabriel
|