Skip to main content

Module json

Module json 

Source
Expand description

Strict JSON finder.

Finds the first valid JSON value rooted at an object ({...}) or array ([...]) in the input. Bare numbers, strings, and literals are intentionally not surfaced — they’re too easy to false-positive on prose.

Validation follows RFC 8259: it checks string escapes (including \uXXXX with UTF-16 surrogate pairing), number shape, and that the only allowed JSON literals are true, false, and null. Inputs whose braces happen to balance but contain garbage ({not really json}) are rejected.

Documents nested deeper than MAX_DEPTH (256 levels) are refused outright: they yield no match at all rather than an arbitrary inner fragment.

Structs§

Json