JSON: Difference between revisions
m
→{{header|Wren}}: Minor tidy
(→{{header|Bracmat}}: Added mention of new UFP object for floating point operations in Bracmat) |
m (→{{header|Wren}}: Minor tidy) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2,180:
'{"age":5,"name":"pojo"}'
</pre>
=={{Header|Insitux}}==
<syntaxhighlight lang="insitux">
(var object {:a 1 :b "Hello, world!" [1 2 3] :c}
serialised (to-json object)
deserialised (from-json serialised))
(print "Object: " object)
(print "Serialised: " serialised)
(str "Deserialised: " deserialised)
</syntaxhighlight>
{{out}}
<pre>
Object: {:a 1, :b "Hello, world!", [1 2 3] :c}
Serialised: {":a":1,":b":"Hello, world!","[1 2 3]":":c"}
Deserialised: {":a" 1, ":b" "Hello, world!", "[1 2 3]" ":c"}
</pre>
Observe that JSON is incapable of lossless serialisation and deserialisation of Insitux data structures, with the recommended approach rather being [https://www.rosettacode.org/wiki/Object_serialization#Insitux <code>str</code> and <code>safe-eval</code>].
=={{header|J}}==
Line 4,036 ⟶ 4,058:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var json = require('JSON::PP').new
var data = json.decode('{"blue": [1, 2], "ocean": "water"}')
say data
data{:ocean} = Hash
say json.encode(data)
{{out}}
<pre>Hash
)
{"blue":[1,2],"ocean":{"water":["fishy","salty"]}}</pre>
Line 4,653 ⟶ 4,675:
=={{header|Wren}}==
{{libheader|Wren-json}}
<syntaxhighlight lang="
var s = "{ \"foo\": 1, \"bar\": [ \"10\", \"apples\"] }"
|