json/emit
src/json/emit.tur
defn
json-emit
(json-emit [doc :int] :cstr)
serialize a JSON document to a compact string.
Parameters
| doc | :int doc handle from json-parse (unwrapped ok-val) |
Returns
:cstr -- compact JSON string (caller owns the memory)
Example
(println (json-emit (ok-val (json-parse "{\"x\":1}"))))
Since: P4
defn
json-emit-pretty
(json-emit-pretty [doc :int] :cstr)
serialize a JSON document to an indented string.
Parameters
| doc | :int doc handle from json-parse (unwrapped ok-val) |
Returns
:cstr -- pretty-printed JSON string (caller owns the memory)
Example
(println (json-emit-pretty (ok-val (json-parse "{\"x\":1}"))))
Since: P4