JSON: Difference between revisions

13 bytes removed ,  5 months ago
m
→‎{{header|Sidef}}: updated code to use JSON::PP (which is a core module)
(→‎Insitux: inclusion)
m (→‎{{header|Sidef}}: updated code to use JSON::PP (which is a core module))
Line 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.new(water => %w[fishy salty]);
say json.encode(data);</syntaxhighlight>
{{out}}
<pre>Hash.new(
'"blue'" => [1, 2],
'"ocean'" => '"water'"
)
)
{"blue":[1,2],"ocean":{"water":["fishy","salty"]}}</pre>
 
2,747

edits