Jack_Liu | 2023-03-02 14:45:00 UTC | #1
Hi all,
We love the new JSON functions in architect, but there is one more piece of the puzzle that would make it especially useful. If there is a way to return the raw result from a data action, then in architect we can parse thru arbitrary JSON objects, ie nested arrays which we currently cannot.
So far I tried creating an output template like the below but it always returns the default value zero. How do I return $value back to the success template?
Any help is appreciated!
{ "translationMap": { "rawjson": "#set( $value = ${rawResult} )" }, "translationMapDefaults": { "rawjson": "0" }, "successTemplate": "{\n \"rawjson\": ${rawjson}\n}" }
Jack_Liu | 2023-03-02 15:13:22 UTC | #2
For the record, after playing with it, this worked.
{ "translationMap": { }, "translationMapDefaults": { }, "successTemplate": "{\"raw_json\": \"$esc.jsonString(\"${rawResult}\")\" }" }
Jason_Mathison | 2023-03-02 15:13:18 UTC | #3
That looks exactly like how I would handle this. Nice work!
--Jason
Jack_Liu | 2023-03-02 16:01:14 UTC | #5
Create a string field in the output contract. Then in Architect use an Update Action to convert from string to JSON using JsonParse.
Jack_Liu | 2023-03-02 16:01:48 UTC | #6
Since the successTemplate defines raw_json, the output field should match that name.
system | 2023-04-02 16:02:41 UTC | #7
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18688