Skip to main content

Module json_tree

Module json_tree 

Source
Expand description

Transforms JSON input into source-neutral tree data.

The complete JSON boundary: the input document is read to the end and the tree retains the raw bytes. Structure is discovered shallowly: scanning a container records only its immediate children’s byte spans (each child’s subtree is structurally skipped, which validates it and yields its child count for free); deeper levels materialize on demand through [materialize], driven by expansion or the app’s background sweep. JSONL defers even record validation — the newline scan is the only startup cost — so corrupt records surface later as error nodes rather than load failures. Labels, previews, pointers, and outputs are derived from spans through the crate-private helpers at the bottom. No JSON values escape this module.

Structs§

Error

Functions§

from_reader
Read the input, detect JSON vs JSONL from the content (one uniform rule, however the input arrived), and build the tree.
jsonl_from_reader
Read the input as JSONL regardless of what detection would say — the --jsonl escape hatch for content that is also valid JSON (e.g. a single record).