yyjson
The fastest JSON library in C
yyjson is a JSON library written in C, built for speed. JSON is the data format that almost every web API and configuration file uses: text structured as keys and values. Programs that process lots of JSON (parsing incoming requests, reading config files, building API responses) need a library to convert between JSON text and in-memory data structures. yyjson is one option for C programs that care about doing this quickly.
The library claims to read and write gigabytes of JSON per second on modern hardware. The README includes benchmark tables comparing it against other well-known C JSON libraries: simdjson, rapidjson, cjson, and jansson. Across tested hardware (AWS servers and Apple A14 phones), yyjson consistently shows the highest throughput for both parsing and writing.
A practical reason to choose yyjson over alternatives is the integration story: the entire library is a single header file and a single C source file. There is nothing to build separately and no dependencies. The code follows the ANSI C89 standard, meaning it compiles on a wide range of platforms and compilers without special flags.
Beyond basic reading and writing, yyjson supports querying and modifying JSON documents using standard specifications: JSON Pointer (addressing a specific value by path), JSON Patch (applying a set of changes), and JSON Merge Patch (merging two objects). It handles large integers and floating point numbers accurately and supports optional JSON5 features like comments and trailing commas.
One noted limitation: accessing elements by index in an array or object is slower than iterating, because the internal structure is a linked list rather than an array. The parsed document is also immutable by default; modifications require creating a mutable copy first.