Skip to content
TurtleKitty edited this page May 12, 2019 · 2 revisions

json

This object contains two functions: parse and stringify.

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

(def vaq-table (: foo 1 bar '(2 3) baz (: x 1 y 2)))
    ; #(table baz #(table y 2 x 1) foo 1 bar (2 3))

(json.parse json-text)
    ; #(table baz #(table x 1 y 2) bar #(vector 2 3) foo 1)

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