flip | 2018-09-07 16:27:10 UTC | #1
Hello all I was wondering if you could help me with this odd webservice I have to use. The data I get back is a nested JSON, but with in that nest there is a sub tree that is dynmanic meaning the contract output needs to be an array or dynamic. I can get the nesting to work if I hard enter 28 for example, but it will never get 29.
Is there a wildcard I can use for the output contract or can I throw it into an array? I have looked for valid data type list for output contracts, but can't seem to find them.
Sample Output ( Simplified )
[details="Output"] "routes": { "28": { "Name": "Testing"}, "29":{ "Name": "DEV"} } [/details]
Output Contract Sample:
"properties": { "routes": { "type": "object", "properties": { "28": { "type": "object", "properties": { "Name": { "description": "Name", "type": "string" } } } } }
Jason_Mathison | 2018-09-07 18:29:05 UTC | #2
You are going to need to use the translation map to turn the parallel objects into one or more arrays.
I typically use http://jsonpath.com/ to work out the JSONPath. For example, starting with your output example I can use this to get an array of names: $.routes.*.Name
system | 2018-10-08 18:29:09 UTC | #3
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: 3509