JSON: Difference between revisions

No change in size ,  9 years ago
m
Move to correct position
(Add solution for Lua using luajson)
m (Move to correct position)
Line 1,454:
(: jiffy decode '"{\"foo\": [1, 2, 3]}")))
(: io format '"~p: ~p~n" (list key value)))
</lang>
 
=={{header|Mathematica}}==
<lang Mathematica>
data = ImportString["{ \"foo\": 1, \"bar\": [10, \"apples\"] }","JSON"]
ExportString[data, "JSON"]
</lang>
 
=={{header|Lua}}==
 
Using the [httpshttp://githubwww.comeharning.us/harningtwiki/luajson/ luajssonluajson] library:
 
<lang lua>local json = require("json")
Line 1,541 ⟶ 1,535:
JSON re-encoded: [42,3.14159,[2,4,8,16,32,64,"apples","bananas","cherries"],{"Li":3,"He":2,"H":1,"X":null},null,true,false]
JSON from new Lua data: [42,3.14159,[2,4,8,16,32,64,"apples","bananas","cherries"],{"Li":3,"He":2,"H":1,"X":null},null,true,false]
 
=={{header|Mathematica}}==
<lang Mathematica>
data = ImportString["{ \"foo\": 1, \"bar\": [10, \"apples\"] }","JSON"]
ExportString[data, "JSON"]
</lang>
 
=={{header|MATLAB}} / {{header|Octave}}==
Anonymous user