JSON Read return in JSON format

I'd like to see an option to have the result of a JSON Read returned as JSON, so it could be fed right into another JSON Read or Write.

2 replies

That only seems to happen if I'm getting a single value.  If I get multiple values or multiple fields, the results can't be fed into another Read or Write.

A1: Variable Set [ Name:%json To:{"students":[{
"name": "Julia Smith","transcript": {
"level": "junior","gpa": "3.5","major": "history",
"courses": [{"name": "HST 101", "grade": "4.0"},
{"name": "HST 201", "grade": "3.0"}]}
},{ "name": "Kevin Thompson","transcript": {
"level": "junior","gpa": "3.5","major": "history",
"courses": [{"name": "HST 101","grade": "4.0"},
{"name": "HST 201","grade": "3.0"}]}
}]} Do Maths:Off Append:Off ]
A2: AutoTools Json Read [ Configuration:Simple Mode: true
Json: %json
Fields: transcript()
Separator: , Timeout (Seconds):60 ]
A3: AutoTools Json Read [ Configuration:Simple Mode: true
Json: %transcript()
Fields: major
Separator: , Timeout (Seconds):60 ]

That's because %transcript() in that case is not valid JSON. It's 2 separate JSON bits separated by a comma. :)

Yes, that's why I'm hoping for an option to make the results be a JSON Array or object. An example application would be to take a JSON Array of weather readings, filter it with a Json Read to get the ones matching some criteria (days vs nights, perhaps, or just the probability of rain for each period) and get that as a JSON Array that can be fed into a JSON Write or another Read.  Thanks :)

But to make it a JSON Array you simply need a [ at the start and a ] at the end, right? :) Yeah, maybe I can include that as an option.

It already does that if you read a field that has JSON as its content:)