Login
7 branches 0 tags
Ben (Win10) Unified lString and lBuffer 81b5bbb 3 years ago 725 Commits
#{##[]
05v module/insert
05v :serialization/json
15
05v tree/new
24
04i 1
0Es exports
0D
23s tree->json
05v [v]
05v #@[documentation: "Converts a tree into a JSON encoded string, you should prefer VAL->JSON" source: ["Converts a tree into a JSON encoded string, you should prefer VAL->JSON" [cat "{" [join [map [tree/keys v] [fn [k] [cat "\"" [keyword->string k] "\": " [val->json [tree/ref v k]]]]] ",\n"] "}"]]]
05v #{##[]
05v cat
05v "{"
05v join
05v map
05v tree/keys
10s v
04i 1
23s anonymous
05v [k]
05v #@[source: [[cat "\"" [keyword->string k] "\": " [val->json [tree/ref v k]]]]]
05v #{##[]
05v cat
05v "\""
05v keyword->string
10s k
04i 1
05v "\": "
05v val->json
05v tree/ref
10s v
10s k
04i 2
04i 1
04i 4
01
}
17
04i 2
05v ",\n"
04i 2
05v "}"
04i 3
01
}
17
0Es tree->json
0D
05v tree/set!
10s exports
23s serialize
23s val->json
05v [v]
05v #@[documentation: "Return V as a JSON encoded string" source: ["Return V as a JSON encoded string" [case [type-of v] [:nil "null"] [[:int :float] [string v]] [:bool [if v "true" "false"]] [[:array :pair] [cat "[" [join [map v val->json] ","] "]"]] [:string [string/write v]] [:symbol [cat "\"" [symbol->string v] "\""]] [:keyword [cat "\"" [keyword->string v] "\""]] [:tree [tree->json v]] [otherwise [throw [list :type-error "Can't encode the value into JSON" v [current-lambda]]]]]]]
05v #{##[]
15
05v type-of
10s v
04i 1
0Es ΓεnΣym-1
0D
10s ΓεnΣym-1
05v :nil
20
0Bo 10
05v "null"
09o 318
10s ΓεnΣym-1
05v :int
20
0C
0Ao 22
0D
10s ΓεnΣym-1
05v :float
20
0C
0Ao 8
0D
05v #f
0Bo 16
05v string
10s v
04i 1
09o 270
10s ΓεnΣym-1
05v :bool
20
0Bo 24
10s v
0Bo 10
05v "true"
09o 7
05v "false"
09o 237
10s ΓεnΣym-1
05v :array
20
0C
0Ao 22
0D
10s ΓεnΣym-1
05v :pair
20
0C
0Ao 8
0D
05v #f
0Bo 44
05v cat
05v "["
05v join
05v map
10s v
10s val->json
04i 2
05v ","
04i 2
05v "]"
04i 3
09o 161
10s ΓεnΣym-1
05v :string
20
0Bo 16
05v string/write
10s v
04i 1
09o 136
10s ΓεnΣym-1
05v :symbol
20
0Bo 30
05v cat
05v "\""
05v symbol->string
10s v
04i 1
05v "\""
04i 3
09o 97
10s ΓεnΣym-1
05v :keyword
20
0Bo 30
05v cat
05v "\""
05v keyword->string
10s v
04i 1
05v "\""
04i 3
09o 58
10s ΓεnΣym-1
05v :tree
20
0Bo 16
05v tree->json
10s v
04i 1
09o 33
05v throw
05v list
05v :type-error
05v "Can't encode the value into JSON"
10s v
05v current-lambda
04i 0
04i 4
04i 1
16
01
}
17
0Es val->json
04i 3
0D
13
16
04i 2
01
}