I have a twilio function which is returning json (it correctly sets the content-type) of the form:
{"brand":"brand", "product":"product"}
This function is called by a twilio studio flow.
Immediately after this widget, I have a "send message" widget with the following template:
{% assign parsedObject= widgets.Extract.body | to_json %}
Thank you! We think you want to buy {{ parsedObject.product}} by {{ parsedObject.brand }}.
Is this correct?
{{widgets.Extract.body.parsed["product"]}}
{{widgets.Extract.body["product"]}}
{{widgets.Extract.body }}
This template demonstrates that widgets.Extract.body contains a string which is valid JSON and its in the expected structure. All I want to do is write out 2 of the properties (brand and product) but I cant seem to get this to work. What am I doing wrong?
The correct result is:
{{widgets.Extract.parsed.product}}
Because my function returns JSON, it is parsed into the "parse" property and accessible there. The liquid to_json filter is not required!