Load a JSON string into a data structure.
Also, create a new data structure and serialize it into JSON.

Use objects and arrays (as appropriate for your language)
and make sure your JSON is valid (https://jsonformatter.org).

-- demo\rosetta\JSON.exw
with javascript_semantics
include builtins/json.e
 
puts(1,"roundtrip (10 examples):\n")
sequence json_strings = {`{"this":"that","age":{"this":"that","age":29}}`,
                         `1`,
                         `"hello"`,
                         `null`,
                         `[12]`,
                         `[null,12]`,
                         `[]`,
                         `{"this":"that","age":29}`,
                         `{}`,
                         `[null,[null,12]]`}
 
for i=1 to length(json_strings) do
    string s = json_strings[i]
    puts(1,s&"\n")
    object json_object = parse_json(s)
    puts(1,print_json("",json_object,true)&"\n")
    if not equal(print_json("",json_object,true),s) then ?9/0 end if
end for
