JSON: Difference between revisions

Content deleted Content added
Bartj (talk | contribs)
Added Bracmat example
Bartj (talk | contribs)
→‎{{header|Bracmat}}: Changed to full length JSON output, so readers can copy/paste to jsonlint
Line 184: Line 184:
=={{header|Bracmat}}==
=={{header|Bracmat}}==


Bracmat has built-in functionality for reading and writing of JSON data.
Bracmat has built-in functionality for reading and writing JSON data.
A full roundtrip from JSON file over a Bracmat internal representation back to a JSON file looks like this:
A full roundtrip from JSON file over a Bracmat internal representation back to a JSON file looks like this:


Line 364: Line 364:
The file "rosetta-roundtrip.json" will contain a single line. There is no beautify option when constructing a JSON string using the <code>jsn</code> function. The http://jsonlint.com service can be used to view the JSON string, but notice that some of the numbers are to big to be handled by this service and are turned into null values.
The file "rosetta-roundtrip.json" will contain a single line. There is no beautify option when constructing a JSON string using the <code>jsn</code> function. The http://jsonlint.com service can be used to view the JSON string, but notice that some of the numbers are to big to be handled by this service and are turned into null values.


Content of rosetta-roundtrip.json (1402 characters, here shortened):
Content of rosetta-roundtrip.json (1402 characters):


<pre>[{"C:\\projects":"23","Cyrillic":["Ya Я","ya я"],"OS/2":{"White\b\f\n\r\tspace":{}},"ape":"\"King Kong\""},"TAB\t",["elem1","elem2"],"Bernhard",[],["x","y","z"],["true",true,false,null],{"fixed point":[3.4,0.00987654321,-10.01,56.78,56.78]},{"floating point":[0,0.00000000000006,17000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-17870000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,870000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,2860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]},{"integer":[-0,0,-5,1234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567890]}]</pre>
<pre>[{"C:\\projects":"23","Cyrillic":["Ya Я","ya я"],"OS/2":{"White\b\f\n\r\tspace":{}},"ape":"\"King Kong\""},"TAB\t",["elem1","elem2"],"Bernhard",[],["x","y","z"],["true",true,false,nul" ...</pre>


After manual reformatting, again shortened where lines run of the screen:
After manual reformatting, again shortened where lines run off the screen:


<pre>[
<pre>[