A C++ JSON parser that uses SIMD instructions to parse gigabytes of JSON per second
open sourceApache-2.0 OR MITfree
simdjson is a C++17 library that parses JSON at gigabytes per second on ordinary processors, using SIMD instructions to validate and parse many bytes at once. It does full JSON and UTF-8 validation with lossless parsing, and its On-Demand API reads only the fields you ask for. It also minifies JSON, validates UTF-8 and parses newline-delimited JSON across threads. You add it as a single header and source file, or build it with CMake. The Node.js runtime, ClickHouse, Velox, Apache Doris and Milvus use it. The simdjson organization also maintains official Python bindings (fastsimdjson), converters to Apache Arrow and MessagePack, and sjq, a jq-compatible command-line tool; community projects bind it to Rust, Ruby, PHP, .NET and many other languages.
Problems it solves
- JSON parsing is the bottleneck in my C++ service
- parse huge newline-delimited JSON log files as fast as possible
- validate that incoming bytes are valid UTF-8 and JSON without slowing the request path
Features
- Parses JSON at gigabytes per second using SIMD instructions
- Full JSON and UTF-8 validation, lossless parsing
- On-Demand API that parses only the fields you read
- Minifies JSON and validates UTF-8 on its own
- Multithreaded parsing of newline-delimited JSON
- Single-header distribution, or a CMake build
- Picks the fastest code path for the CPU at runtime
Alternatives
The same job
These do what simdjson does.
- RapidJSON A fast JSON parser/generator for C++ with both SAX/DOM style API
- JSON for Modern C++ What if JSON was part of modern C++?
