JSON: Difference between revisions

Content added Content deleted
(Added 11l)
Line 280: Line 280:
=={{header|Arturo}}==
=={{header|Arturo}}==


<lang rebol>print read.json {{ "foo": 1, "bar": [10, "apples"] }}
<lang arturo>// set some json string
json: "{ \"foo\": 1, \"bar\": [10, \"apples\"] }"


object: #[
// parsing json string to object
print "JSON:"
inspect [parseJson json]

// set some object
object: #{
name: "john"
name: "john"
surname: "doe"
surname: "doe"
address: #{
address: #[
number: 10
number: 10
street: "unknown"
street: "unknown"
country: "Spain"
country: "Spain"
]
}
married: false
married: false
]
}


// generate json string from object
print write.json ø object</lang>
print "OBJECT:"
print [generateJson object]
</lang>


{{out}}
{{out}}


<pre>JSON:
<pre>[foo:1 bar:[10 apples]]
#{
bar : #(
10
"apples"
)
foo : 1
}
OBJECT:
{
{
"name": "john",
"name": "john",