++en-json:html
Print json
Encode val
, a json
structure, in a tape
.
Accepts
val
is any json
.
Produces
A tape
.
Source
This is a very large function, refer to zuse.hoon
for the source code.
Examples
> (en-json:html s+'foo')
"\"foo\""
> (en-json:html o+(malt (limo ~[['foo' s+'xxx'] ['bar' n+'123'] ['baz' b+&]])))
"\{\"foo\":\"xxx\",\"baz\":true,\"bar\":123}"
++de-json:html
Parse json
Parse cord a
to a json
structure. The result is wrapped in a unit which is null if parsing failed.
Accepts
a
is a cord
in which JSON is encoded.
Produces
A (unit json)
. The unit
is ~
if parsing failed.
Source
This is a very large function, refer to zuse.hoon
for the source code.
Examples
> (de-json:html '{"foo":"xxx","baz":true,"bar":123}')
[~ [%o p={[p='bar' q=[%n p=~.123]] [p='baz' q=[%b p=%.y]] [p='foo' q=[%s p='xxx']]}]]
> (de-json:html '"foo"')
[~ [%s p='foo']]