Overview of RapidJSON APIs and Features
masterRapidJSON provides two primary styles of interaction with JSON data:
- DOM API: Parses JSON into a tree-like structure (
Document) that can be traversed and modified. Best for complex manipulations. - SAX API: A stream-based parser that triggers events during parsing. It is extremely fast and memory-efficient (the SAX parser is only ~500 lines of code).
Key Features
- Performance: Highly optimized; can be comparable to
strlen(). Supports SSE2/SSE4.2 acceleration. - Memory Efficiency: Each
Valueoccupies exactly 16 bytes on most 32/64-bit machines (excluding text strings). - Unicode Support: Supports UTF-8, UTF-16, and UTF-32 (LE & BE) with internal validation and transcoding.
- Compliance: Fully compliant with RFC7159/ECMA-404, with optional support for relaxed syntax (comments, trailing commas, NaN/Infinity).
- Header-only: No external dependencies like BOOST or even STL required.