JSON: Difference between revisions

640 bytes added ,  13 years ago
no edit summary
No edit summary
Line 60:
{ { "blue" { "ocean" "water" } } >json
</lang>
 
=={{header|Fantom}}==
 
<lang fantom>
using util
 
class Json
{
public static Void main ()
{
Str input := """{"blue": [1, 2], "ocean": "water"}"""
Map jsonObj := JsonInStream(input.in).readJson
 
echo ("Value for 'blue' is: " + jsonObj["blue"])
jsonObj["ocean"] = ["water":["cold", "blue"]]
Map ocean := jsonObj["ocean"]
echo ("Value for 'ocean/water' is: " + ocean["water"])
output := JsonOutStream(Env.cur.out)
output.writeJson(jsonObj)
echo ()
}
}
</lang>
 
Output:
<pre>
Value for 'blue' is: [1, 2]
Value for 'ocean/water' is: [cold, blue]
{"blue":[1,2],
"ocean":{"water":["cold","blue"]}}
</pre>
 
=={{header|Go}}==
Anonymous user