No matching definitions.

json/parse

src/json/parse.tur
defn

json-parse

(json-parse [json : cstr] :)

parse a JSON string into an opaque document handle.

jsonNUL-terminated JSON string

(Result int cstr) -- ok carries the doc handle (as :int); err carries a heap-allocated diagnostic message. The doc handle must be freed with json-free when no longer needed.

(let [r (json-parse "{\"x\":1}")]
    (if (ok? r) (json-emit (ok-val r)) "parse error"))

Since: P4

defn

json-free

(json-free [doc : int] :)

free a document handle returned by json-parse.

doc:int doc handle (unwrapped ok-val from json-parse result)
(json-free (ok-val r))

Since: P4