ibireme/yyjson logo

ibireme/yyjson

Free

The fastest JSON library in C

FreeFree tier
Type
Open Source

About ibireme/yyjson

yyjson is a high-performance JSON library written in ANSI C (C89). It is designed for speed and portability, capable of reading or writing gigabytes of JSON data per second on modern CPUs. The library complies strictly with RFC 8259, supports accurate number handling (int64, uint64, double), and offers unlimited nesting levels along with support for null characters and non-null-terminated strings. It also provides manipulation via JSON Pointer, JSON Patch, and JSON Merge Patch, and is easy to integrate with a single header and source file. yyjson includes options for selected JSON5 features and custom memory allocators, making it suitable for performance-critical applications across platforms.

Key Features

Reads or writes gigabytes of JSON data per second on modern CPUs
Portable: complies with ANSI C (C89), no explicit SIMD
Strict compliance with RFC 8259, including strict number formats and UTF-8 validation
Optional JSON5 features and custom memory allocator
Accurate handling of int64, uint64, and double numbers
Supports unlimited JSON nesting levels, \u0000 characters, and non-null-terminated strings
Query and modify JSON using JSON Pointer, JSON Patch, and JSON Merge Patch
Easy integration with just one .h and one .c file

Pros & Cons

Pros
  • Exceptional parsing and stringification speed, outperforming many popular C libraries
  • Small and simple codebase (single .h and .c file) for easy integration
  • Portable across ANSI C compilers without architecture-specific optimizations
  • Strict RFC 8259 compliance ensures reliable and standard-compliant JSON processing
  • Supports advanced JSON manipulation operations (Pointer, Patch, Merge Patch)
  • Flexible: handles unlimited nesting, null characters, and non-null-terminated strings
Cons
  • Arrays and objects stored as linked lists; element access by index/key is slower than using an iterator
  • Duplicate keys are allowed in objects, which may be undesirable for some use cases
  • Parsing results are immutable; modification requires creating a mutable copy
  • Simdjson's On-Demand API can be faster when JSON fields are known at compile time

Best For

High-performance JSON parsing in C applicationsJSON serialization and deserialization in embedded systemsBuilding tools and libraries that require fast JSON processingReplacing slower JSON parsers in performance-critical softwareStrictly validated JSON input for security-sensitive contexts

FAQ

What is yyjson?
yyjson is a high-performance JSON library written in ANSI C (C89) that focuses on speed, portability, and strict RFC 8259 compliance.
Is yyjson compliant with the JSON standard?
Yes, yyjson strictly complies with RFC 8259, including strict number formatting and UTF-8 validation.
Does yyjson support JSON5?
yyjson offers options to enable selected JSON5 features, but it is not a full JSON5 parser by default.
How is yyjson licensed?
yyjson is open-source. The repository includes an MIT license file.
Can I modify a parsed JSON document?
Parsing results are immutable. To modify a document, you must first create a mutable copy.