Skip to content
Turtle Kitty edited this page Aug 9, 2015 · 2 revisions

json

This object contains two functions: parse and stringify.

(def t (text: { "foo": 1, "bar": [ 2, 3 ], "baz": { "x": 1, "y": 2 }}))
    -> "{ \"foo\": 1, \"bar\": [ 2, 3 ], \"baz\": { \"x\": 1, \"y\": 2 }}"

(def r (: foo 1 bar '(2 3) baz (: x 1 y 2)))
    -> (record: baz (record: y 2 x 1) foo 1 bar (2 3))

(json.parse t)
    -> (record: baz (record: x 1 y 2) bar (vector: 2 3) foo 1)

(json.stringify r)
    -> "{\"bar\":[2,3],\"foo\":1,\"baz\":{\"x\":1,\"y\":2}}"
Clone this wiki locally