Jsonifier uses SIMD structural indexing and compile-time perfect hash maps to read and write JSON 1.7x to 2.1x faster than Glaze and 1.8x to 3.1x faster than simdjson, across every major compiler and both x86-64 and ARM64. (Nov 13, 2026 results)
- Schema-aware (reflected structs): 1015 wins, 10 ties, and 20 losses in 1045 head-to-head tests against Glaze and simdjson on Linux, macOS, and Windows.
- Faster reads: geometric-mean parse throughput is 1.31x to 1.54x that of Glaze and 1.64x to 2.19x that of simdjson On Demand.
- Faster writes: geometric-mean serialization throughput is 2.04x to 3.37x that of Glaze and 5.47x to 6.35x that of simdjson's C++26 reflection writer.
- Generic (schemaless) parsing: 1697 wins, 18 ties, and 85 losses in 1800 head-to-head tests against simdjson On Demand, running 1.26x to 1.37x faster across all five builds.
- Portable: CI-verified on GCC, Clang, and MSVC, on both the detected SIMD backend (whatever the runner's CPU supports, such as AVX-512 on x86-64 or NEON on arm64 macOS) and the pure-scalar fallback.
- Strict: fully RFC8259 compliant.
| Platform | vs Glaze (schema-aware) | vs simdjson (schema-aware) | vs simdjson On Demand (generic) |
|---|---|---|---|
| Linux GCC 16.2.1 | 1.79x | 2.70x | 1.26x |
| Linux Clang 24.0.0 | 1.82x | 1.84x | 1.28x |
| macOS GCC 16.2.0 | 2.13x | 3.07x | 1.37x |
| macOS Clang 23.1.4 | 2.07x | 2.18x | 1.37x |
| Windows MSVC 19.52 | 1.71x | 1.82x | 1.26x |
Geometric mean of per-test throughput ratios: Jsonifier's best variant against each competitor's best variant. Glaze has no schemaless entry in the generic suite.
Jsonifier is fully RFC8259 compliant.
A high-performance C++ library for validating, serializing, parsing, prettifying, and minifying JSON data, very rapidly.
It achieves this through the usage of SIMD instructions as well as compile-time hash maps for efficient key lookups during parsing.
- Stage-1 Document
- Full Arch Document
- Generic Parsing Document
- Serialization Document
- Benchmarks
- More Benchmarks
Android:
JSONIFIER_PLATFORM_ANDROIDis detected and handled distinctly fromJSONIFIER_PLATFORM_LINUX(separatemmap/unistd.hwiring, its own entry in the supported-platform check), for NDK cross-compilation. It is not part of the CI matrix above, so treat it as best-effort rather than continuously verified.
Jsonifier automatically detects and optimizes for your CPU architecture:
- x64 / AMD64: 64-bit extension of x86 with enhanced memory addressing
- AVX: 128-bit vector registers for SIMD operations
- AVX2: 256-bit vector registers with additional integer operations
- AVX-512: 512-bit vector registers for maximum parallelism (requires F + BW + VBMI2 support detected together)
- PCLMULQDQ: carry-less multiplication support, detected and used where available
- ARM-NEON: SIMD instructions for ARM processors
- ARM-SVE2: scalable vector extensions for ARM processors
⚠️ experimental: the SVE2 backend is new and still under active development; a handful of parsing cases are not yet handled correctly. NEON remains the recommended path for production ARM builds until SVE2 correctness is fully verified. Feedback and bug reports on SVE2-specific behavior are very welcome.
Exactly one SIMD backend is compiled into each build, chosen at configure time; nothing is selected at run time. A binary configured for AVX-512 requires AVX-512 on every machine that runs it, so configure for the lowest tier you need to support when distributing to mixed hardware. Pass -DJSONIFIER_SIMD_TIER=AVX2 (or AVX, NEON, NONE, ...) at configure time to build a lower tier than the one detected. See One tier per build.
Manual configuration and cross-compilation are supported by defining JSONIFIER_CPU_INSTRUCTIONS (plus JSONIFIER_SVE2_VECTOR_BITS for SVE2 targets) at CMake configure time, which replaces the detected feature bits with the target's. See Overriding the Detected Features.
Structures are registered via template specialization using member pointers as non-type template parameters. No macros, no code generation, no runtime type registry; the entire schema is known to the compiler, which means key lookups collapse into compile-time hash-map dispatch and dead branches get eliminated before they exist. Custom JSON key names (kebab-case, digit-prefixed, reserved words) are handled at compile time via makeJsonEntity<&member, "custom-name">() with zero runtime overhead.
Structural indexing runs through a batched-drain, fused-scan architecture: character classification, quote-scope tracking, and UTF-8 validation happen in the same pass over the input, with cross-SIMD-width validation state carried between blocks via a dedicated register-scoped validator. The structural index itself is stored as a compact array of offsets into the source buffer rather than raw pointers, keeping the index footprint small and cache-friendly. Everything the compiler can know statically about the target architecture (cache-line size, vector width, alignment) is baked into the binary as constexpr.
Full UTF-8 validation runs as part of every parse, always, built on a Lemire/simdjson-derived table-lookup validator with both a bulk-buffer path and a streaming, register-scoped path that carries state across chunk boundaries. Validation is fused directly into string scanning rather than requiring a separate pass. Correctness is backed by the full Markus Kuhn UTF-8 stress-test corpus, alignment-sweep fuzzing, and page-boundary overrun checks.
Key lookups during parsing use compile-time-generated hash maps. Structs with 0, 1, 2, or 3 fields get dedicated maps; larger ones fall through a compile-time cascade (single distinguishing byte, first byte plus unique column, unique byte plus length, unique column per length, and finally a seeded SIMD full-key hash) until one produces a collision-free table. No bucket walks; the lookup is generated for the specific set of keys your struct declares.
Full RFC8259 compliance. All types (objects, arrays, strings, numbers, booleans, null), full Unicode with proper surrogate-pair handling, all escape sequences, and jsonifier::raw_json_data for preserving arbitrary sub-trees verbatim.
- Default parsing: single pass over the raw buffer, compile-time hash-map key dispatch, keys accepted in any order
- Known-order parsing: tries the declaration-order key first, then a self-tuning per-position memo, then the hash map; adds a fused literal-match fast path for minified input
- Partial reading: parse unordered or partial JSON structures
- Arbitrary data: work with unknown JSON via
raw_json_data - Generic (schema-free) parsing: lazy, On Demand-style
jsonifier_core::iteratewith re-readable values, out-of-order field access, JSON Pointers anditerateManyfor NDJSON and comma-delimited streams
Every parsing-family test in the suite is run across all eight combinations of partialRead, knownOrder, and nullTerminated.
Full-document parses can take either the default fused single-pass path or the two-stage (stage-1 tape + stage-2) path, selected with partialRead = true. Which one is faster depends on whether your input is indented and which SIMD backend you are on. The Two Stages, On Demand whitepaper measures both paths in one binary across 245 tests on five builds; its results suggest:
| Input | x86 (AVX2 / AVX-512) | ARM (NEON) |
|---|---|---|
| POD-type values | Fused (default): won all 15 | Fused (default): won all 10 |
| Minified documents | Fused (default) + minified = true: won 61 of 66 |
Fused (default) + minified = true: won all 44 |
| Prettified documents | Two-stage (partialRead = true): won 63 of 66 |
Fused (default): won 34 of 44 |
// Minified input, any architecture
parser.parseJson<jsonifier::parse_options{ .minified = true }>(data, json);
// Prettified input on x86
parser.parseJson<jsonifier::parse_options{ .partialRead = true }>(data, json);
// Prettified input on NEON
parser.parseJson(data, json);Notes from the data:
- The five minified documents the tape won on x86 were all under MSVC (Marine IK and Marine IK Reverse among them), so MSVC users parsing number-heavy minified input may want to benchmark both paths.
- On x86 the two-stage path wins prettified documents by up to roughly 45%; on NEON the fused path wins most of them, with GCC leaning a little more toward the tape than Clang.
- If you control the producer,
minifyJsononce and parse withminified = true: minified input on the fused path is the fastest combination on every platform measured. - Add
knownOrder = truewhen keys arrive in declaration order (see Known Order Parsing). - Jsonifier does not yet pick the path automatically from architecture, compiler or indentation, so this choice is yours to make.
Comprehensive error reporting with source location tracking, backed by a compact, purpose-built status-code model: parsing, validation, minification, and prettification each propagate failure immediately on the first error rather than continuing to walk a broken buffer. Configurable maximum nesting depth (parse_options::maxDepth, default 1024) guards against malicious or runaway input.
Continuous integration runs AddressSanitizer and UndefinedBehaviorSanitizer on every push across every supported platform and compiler. The conformance test suite covers the full RFC8259 pass/fail battery (both the classic jsonchecker corpus and the full JSONTestSuite Y/N corpus), plus dedicated UTF-8 correctness tests including the full Markus Kuhn stress-test set, chunk/block-boundary crossings, unaligned-pointer sweeps, and an mmap page-boundary fault check.
Every push runs the full unit-test suite on Ubuntu (Clang/GCC), macOS (Clang/GCC), and Windows (MSVC), with ASan and UBSan enabled where supported, once with the detected SIMD backend and once more as a pure-scalar build (JSONIFIER_CPU_INSTRUCTIONS=0). See Unit Tests for the CI setup, how to run the tests locally, and a breakdown of every test suite.
#include <jsonifier>
struct event {
int64_t id{};
std::string name{};
std::optional<std::string> logo{};
std::vector<int64_t> topicIds{};
};
struct catalog {
std::unordered_map<std::string, event> events{};
std::string schema_version{};
};
template<> struct jsonifier::core<event> {
using value_type = event;
static constexpr auto parseValue = createValue<
&value_type::id,
&value_type::name,
&value_type::logo,
&value_type::topicIds>();
};
template<> struct jsonifier::core<catalog> {
using value_type = catalog;
static constexpr auto parseValue = createValue<
&value_type::events,
makeJsonEntity<&value_type::schema_version, "schema-version">()>();
};
int32_t main() {
jsonifier::jsonifier_core<> parser;
catalog data;
std::string json = R"({"events":{"42":{"id":42,"name":"Concert","logo":null,"topicIds":[1,2,3]}},"schema-version":"1.0"})";
parser.parseJson(data, json);
std::string output;
parser.serializeJson(data, output);
return 0;
}Note the makeJsonEntity<&value_type::schema_version, "schema-version">(): Jsonifier maps the C++-legal schema_version member to the kebab-case "schema-version" key in JSON entirely at compile time, with zero runtime cost.
Warning: Include only . Direct inclusion of internal headers may cause unrelated code in the including translation unit to become uncompilable.
The jsonifier_core<> type is templated on an initial scratch-buffer size in bytes (default 1MB), e.g. jsonifier::jsonifier_core<4 * 1024 * 1024> parser; for workloads that consistently deal with larger documents. It is compiled for the single SIMD tier configured at build time, so a binary configured for AVX-512 requires AVX-512 on every machine that runs it. See Backends and the Core.
Some users may want to browse code along with the compiled assembly. The following examples use the Jsonifier trunk available on Compiler Explorer:
- Schema-aware parsing: Ice Lake (AVX-512), Haswell (AVX2), NEON
- Schema-aware serializing: Ice Lake (AVX-512), Haswell (AVX2), NEON
- Installation: Install via vcpkg, CMake FetchContent, or source
- Quick Start: Five-minute onramp with a working example
- Reflection: Registering structures with compile-time reflection
- Serializing & Parsing: Complete serialization/parsing guide
- Validating: JSON validation against RFC standards
- Known Order Parsing: Guaranteed-order optimization for hot paths
- Optimizing For Minified JSON: Boost performance for minified input
- Partial Reading: Parse unordered or partial JSON structures
- CPU Architecture Selection: Configure-time backend selection, stage-1 step tuning, and manual CPU instruction set configuration, including SVE2 and cross-compilation overrides
- Prettifying: Pretty-print JSON with customizable indentation
- Minifying: Minify JSON for compact output
- UTF-8 Validation: Cross-SIMD-width validation architecture
- Error Handling: Detailed error reporting and handling
- Excluding Keys at Runtime: Dynamic key exclusion during serialization
- Parsing Arbitrary Data: Working with unknown JSON structures
- Generic Parsing: Schema-free, On Demand-style parsing and NDJSON or comma-delimited streams
- Unit Tests: CI matrix, running tests locally, and everything the suite covers
- CMake 3.28 or later
- C++23 compliant compiler (MSVC 2022 v19.40+, GCC 14+, Clang 18+)
- Supported CPU (x64, ARM64 with NEON or SVE2*)
* SVE2 support is experimental; see the CPU Architecture Support section above.
This library is licensed under the MIT License. See the LICENSE file for details.
-
SIMD parsing techniques inspired by simdjson
-
Reflection interface inspired by Glaze
-
zmij for shortest round-trip float serialization
-
FastFloat for number parsing
-
Unit test harness: rt-ut
-
Raymond, because, Thanks.
-
Paul Mandarino. "Back yourself up, back your words up."
-
Claude:
Contributions are welcome! Please feel free to submit pull requests or open issues on GitHub.
Star this repository if you find it useful! ⭐

