50,861
stars
+9+26+112
7,517
forks
732
watchers
2,160
prs
2,523
issues
45
releases
1,020
discussions
README
- Design goals - Sponsors - Support (documentation, FAQ, discussions, API, bug issues) - Quick reference - Examples - Read JSON from a file - Creating json objects from JSON literals - JSON as a first-class data type - Serialization / Deserialization - STL-like access - Conversion from STL containers - JSON Pointer and JSON Patch - JSON Merge Patch - Implicit conversions - Conversions to/from arbitrary types - Specializing enum conversion - Binary formats (BSON, CBOR, MessagePack, UBJSON, BJData, and BON8) - Customers - Ecosystem - Supported compilers - Integration - CMake - Package Managers - Pkg-config - License - Contact - Security - Thanks - Used third-party tools - Notes - Execute unit tests Design goals There are myriads of JSON libraries out there, and each may even have its reason to exist. Our class had these design goals: - Intuitive syntax. In languages such as Python, JSON feels like a first-class data type. We used all the operator magic of modern C++ to achieve the same feeling in your code. Check out the examples below and you'll know what I mean. - Trivial integration. Our whole code consists of a single header file json.hpp. That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings. The library is also included in all popular package managers. - Serious testing. Our code is heavily unit-tested and covers 100% of the code, including all exceptional behavior. Furthermore, we checked with Valgrind and the Clang Sanitizers that there are no memory leaks. Google OSS-Fuzz additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the OpenSSF Best Practices. See the quality assurance overview documentation. Other aspects were not so important to us: - Memory efficiency. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: std::string for strings, int64_t, uint64_t or double for numbers, std::map for objects, std::vector for arrays, and bool for Booleans. However, you can template the generalized class basic_json to your needs. - Speed. There are certainly faster JSON libraries out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a std::vector or std::map, you are already set. See the contribution guidelines for more information. Sponsors You can sponsor this library at GitHub Sponsors. :raising_hand: Priority Sponsor - Martti Laine - Paul Harrington - Mercedes-Benz Group - Ryan McCaffery :label: Named Sponsors - Michael Hartmann - Stefan Hagen - Steve Sperandeo - Robert Jefe Lindstädt - Steve Wagner Furt
Top issues
#1170Custom Precision on floating point numbers39 comments · 2018-07-19#3578Unable to use gnu mpz types for NumberIntegerType25 comments · 2022-07-11#5294Ideas: exploring ways to reduce compilation time10 comments · 2026-07-22#5298Idea: arena / PMR document mode (O(1) teardown)7 comments · 2026-07-22#5959Proposal: minimal API for an opt-in C++26 static-reflection extension4 comments · 2026-10-29#6027Idea: Decode into an existing value and reuse its storage (get_into)3 comments · 2026-11-05#5786The exception classes' create() functions are public by accident3 comments · 2026-10-08#5297Idea: canonical / deterministic serialization (RFC 8785 JCS)2 comments · 2026-07-22
Discussions
#5955Clarification of JSON key escape decoding and name delivery timing, separately for parser_callback_t and json_sax::key2 comments · 2026-10-28#5893Companion headers: a concept for optional features outside json.hpp2 comments · 2026-10-22#5789Query.Farm JSON Schema for DuckDB: suggestion for the Customers page0 comments · 2026-10-08#5749Are AI assisted contributions welcome?2 comments · 2026-10-01#5574new point release1 comments · 2026-09-25#5535Great job and thank you1 comments · 2026-09-16#5384[C++26] Reflection-based to_json/from_json: 672 lines replace NLOHMANN_DEFINE_TYPE_INTRUSIVE4 comments · 2026-08-16#5377When writing empty objects the serializer ignores pretty printing the empty object.1 comments · 2026-08-12
Latest release
JSON for Modern C++ version 3.12.0 v3.12.0 2025-04-11Release date: 2025-04-11 SHA-256: aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63 (json.hpp), b8cb0ef2dd7f57f18933997c9934bb1fa962594f701cd5a8d3c2c80541559372 (include.zip), 42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa (json.tar.xz) Summary This release fixes some bugs found in the 3.11.3 release and adds some new features. All changes are backward-compatible. :moneybag: Note you can support this project via GitHub sponsors or PayPal. Key updates and enhancements - Diagnostic byte positions: A new macro, JSON_DIAGNOSTIC_POSITIONS, intro