Jump to content

JSON: Difference between revisions

Line 1,530:
strings, and objects. Nor is there a standardized Forth library to build
and use such structures. But there are many different Forth libraries,
written by individuals, available. Thoughthough finding them is not always easy and the syntax and behavior is different for each.
The syntax and behavior is different for each.
The library code used below can be found here:
https://github.com/DouglasBHoffman/FMS2
 
Load a JSON Forth string into a data structure.
<pre>
s\" {\"value\":10,\"flag\":false,\"array\":[1,2,3]}" $>json value j
Line 1,549 ⟶ 1,548:
Create a new data structure and serialize it into JSON.
<pre>
j{ "another":"esc\"apedap\u20ACed" }j 1 j :insert j :.
j :.
</pre>
Prints the modified JSON:
Line 1,556 ⟶ 1,554:
{
"value": 10,
"another": "esc"apedap€ed",
"flag": false,
"array": [ 1, 2, 3]
Line 1,562 ⟶ 1,560:
 
 
Convert the JSON object into a string object. Print the string.
<pre>
j json>$ :.
</pre>
{\"value\":10,\"another\":\"esc\"apedap\u20ACed",\"flag\":false,\"array\":[1,2,3]}
 
=={{header|Fortran}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.