← Back to Blog 0.7.0 · APPS · BROWSER

JSON Parser — Quote/Colon/Comma Scan

June 23, 2026 · Sigil-Docs · sigil-apps 51f8602
apps browser net 0.7.0

json_parse.sg is the T17 sprint — minimal JSON object parser, quote/colon/comma scan. Reads {"key":"value",...} bytes from json_buf @0x500000. Extracts top-level string key/value pairs (no escapes) via find_quote()/find_colon()/find_comma() scan. Stores up to 8 pairs (as {key_off, key_len, val_off, val_len} structs) at jv_buf @0x510000 with decoded strings in jstr_buf @0x520000. JSON-PARSE-PASS 7/7. 11424 B arm-el0.

Minimal JSON parser

json_parse()
quote/colon/comma scan, 8-pair storejson_parse(json_buf, jv_buf, jstr_buf, max_pairs): parses top-level object {...} into at most max_pairs (=8) key/value pairs. Algorithm: (1) skip leading {; (2) scan for quoted string (between " marks), extract as key; (3) scan for :, then another quoted string for value; (4) scan for , to continue or } to end; (5) write {key_off, key_len, val_off, val_len} to jv_buf. No escape handling — assumes clean JSON. Test: parse 3 key/value pairs from simple JSON. JSON-PARSE-PASS 7/7.