A modern C++ approach to JSON Sax Parsing
summary
Claims a SAX-style, event-driven JSON parser called better CPP sucks that parses gigabyte drone-show files on a Raspberry Pi (4 GB RAM) without loading a DOM. It layers an underlying token source (simdjson / nlohmann / RapidJSON), uses a stack-of-parsers state model that returns parser-instructions, and exposes simple scalar/object/list helpers. The implementation is ~450 lines, uses minimal memory (author reports kilobytes vs simdjson’s multi-gigabyte DOM), trades peak speed for low memory and streaming behavior, and still incurs many std::string allocations.
AI-written summary · about
chapters (12)
- 0:00Introduction and use case
- 1:42Defining the problem
- 3:06DOM versus SAX parsing
- 6:19Designing the parser
- 7:43State management architecture
- 12:34Implementing the core API
- 15:05Refining the parser API
- 18:28Parsing scalar types
- 21:36Object and list parsing
- 25:01Validation and stream parsing
- 28:49Performance and conclusions
- 30:27Benchmarks and Q&A
