json/parse
src/json/parse.tur
defn
json-parse
(json-parse [json :cstr] :ptr<void>)
parse a JSON string into an opaque document handle.
Parameters
| json | NUL-terminated JSON string |
Returns
result<:int> -- ok(doc-handle) on success, err(:cstr message) on failure. The doc handle must be freed with json-free when no longer needed.
Example
(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] :void)
free a document handle returned by json-parse.
Parameters
| doc | :int doc handle (unwrapped ok-val from json-parse result) |
Example
(json-free (ok-val r))
Since: P4
Internal definitions
__ok__err