Data Action returning JSON in success template

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": {
"raw_json": "#set( $value = ${rawResult} )"
},
"translationMapDefaults": {
"raw_json": "0"
},
"successTemplate": "{\n "raw_json": ${raw_json}\n}"
}

1 Like

For the record, after playing with it, this worked.

{
"translationMap": {
},
"translationMapDefaults": {
},
"successTemplate": "{"raw_json": "$esc.jsonString("${rawResult}")" }"
}

1 Like

That looks exactly like how I would handle this. Nice work!

--Jason

Create a string field in the output contract. Then in Architect use an Update Action to convert from string to JSON using JsonParse.

Since the successTemplate defines raw_json, the output field should match that name.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.