gleamunison/json
The JSON boundary: one codec, one renderer, one escaper.
encode/decode are the binary codec (gleamunison_json). term_to_json
and json_quote are the string renderer that the CLI envelope and the HTTP
response envelope share — declared here once, because two envelopes that
disagree about how a value becomes JSON, or how a string is escaped, are
two contracts and not one.
Values
pub fn json_quote(text: String) -> String
JSON-escape a string. The FFI owns escaping (control characters, UTF-8), so the envelope and the values it wraps agree on one encoder.
pub fn term_to_json(term: dynamic.Dynamic, depth: Int) -> String
Render a runtime term as JSON: native where the shape is unambiguous,
tagged for constructors, opaque where JSON has no honest representation.
depth bounds the recursion.