About this project

nlohmann/json (JSON for Modern C++) is a header-only C++ library that provides JSON support for C++11 and later. The entire implementation is contained in a single file (single_include/nlohmann/json.hpp), requires no external dependencies or complex build setup, and is distributed through many package managers. It is designed to make JSON feel like a first-class data type in C++, using operator overloading and initializer lists for intuitive object and array construction. The library includes parsing and serialization from/to strings, streams, and iterator ranges; STL-like access to elements; and conversions between JSON values and standard C++ types, including arbitrary user-defined types via specialization. It implements JSON Pointer, JSON Patch, and JSON Merge Patch for querying and modifying documents, and supports several binary serialization formats: BSON, CBOR, MessagePack, UBJSON, and BJData. A SAX-style parsing interface is also available for event-driven use. Per the README, the project emphasizes thorough testing: 100% unit test coverage, memory checks with Valgrind and Clang sanitizers, and continuous fuzz testing through Google OSS-Fuzz. The documentation, FAQ, API reference, and examples are hosted at json.nlohmann.me. Integration options include CMake, package managers, and pkg-config. The library supports UTF-8 only; other encodings need error-handler configuration during dumping.