JSON: Difference between revisions

Content added Content deleted
Line 1,534: Line 1,534:
https://github.com/DouglasBHoffman/FMS2
https://github.com/DouglasBHoffman/FMS2


Load a JSON Forth string into a data structure.
Load a JSON Forth string into a json data structure and print it.
<pre>
<pre>
s\" {\"value\":10,\"flag\":false,\"array\":[1,2,3]}" $>json value j
s\" {\"value\":10,\"flag\":false,\"array\":[1,2,3]}" $>json value j
Line 1,546: Line 1,546:
}
}


Create a new data structure and serialize it into JSON.
Create a new data structure (here a Json pair), serialize it into JSON, and insert it into the previous Json object. Print it again.
<pre>
<pre>
j{ "another":"esc\"ap\u20ACed" }j 1 j :insert j :.
j{ "another":"esc\"ap\u20ACed" }j 1 j :insert j :.