Standard LibraryM3
Strict RFC 8259 JSON Parsing & Encoding
Strict JSON builtins differentially verified against 1,049 Python oracle documents.
6 min readUpdated: v0.8.0-rc Reference
Strict RFC 8259 Compliance
HADID rejects trailing commas, single quotes, unescaped control bytes, and non-finite floats. Verified against 1,049 strict oracle cases and OOM recovery tests.
hadid · EN
let doc = "{\"name\":\"Hadid\",\"version\":8,\"stable\":true}";assert(json_valid(doc), "document must be valid JSON");match (json_get(doc, "name")) { Ok(opt) => { match (opt) { Some(raw) => { match (json_as_string(raw)) { Ok(v) => { print("name = " + v); } Err(e) => { print(e); } } } None => { print("missing"); } } } Err(e) => { print(e); }}match (json_keys(doc)) { Ok(keys) => { print("key count = " + json_from_i64(length(keys))); } Err(e) => { print(e); }}