Overview of RapidJSON features and APIs
masterRapidJSON is a high-performance C++ JSON parser and generator. It provides two distinct API styles:
- DOM (Document Object Model) API: Parses JSON into a memory-resident tree structure. Best for when you need to navigate, modify, or access JSON data multiple times.
- SAX (Simple API for XML) API: A stream-based parser that triggers events as it reads the JSON. It is extremely fast and memory-efficient (the SAX parser is ~500 lines of code) because it doesn't build a full tree in memory.
Key Characteristics
- Fast: Performance is comparable to
strlen(); supports SSE2/SSE4.2 acceleration. - Memory-friendly: Most 32/64-bit machines use exactly 16 bytes per
Value(excluding text strings). - Self-contained: Header-only; no dependencies on BOOST or STL.
- Unicode-friendly: Supports UTF-8, UTF-16, and UTF-32, including transcoding and validation.
- Compliance: Fully compliant with RFC7159/ECMA-404, with optional support for relaxed syntax (comments, trailing commas, NaN/Infinity).