jsoncpp
A C++ library for interacting with JSON.
A C++ library for reading and writing JSON data, with the rare ability to preserve comments, making it practical for config files humans need to edit. Currently in maintenance mode, focused on stability and security.
JsonCpp is a C++ library that lets programs read and write JSON data. JSON is a text format widely used to exchange information between systems, storing things like lists of values, key-value pairs, and numbers or strings. JsonCpp handles converting that text into data your program can work with, and converting it back to text when you need to save or send it.
One feature that sets JsonCpp apart from similar libraries is that it can preserve comments when reading and writing JSON files. This makes it practical for storing configuration files that humans need to edit, since comments are normally stripped out by most JSON tools.
The project is in maintenance mode, which means the team is focused on keeping it stable and secure rather than adding new capabilities. Active work covers fixing security issues found through testing, ensuring the library compiles cleanly on recent versions of common C++ compilers, and fixing any bugs that cause incorrect behavior. New features and performance improvements are explicitly out of scope.
There are two supported versions. The current main version requires a C++ standard from 2011 or later. An older branch supports compilers that predate that standard, but only receives critical security fixes. The library is available through several common C++ package managers including vcpkg, Conan, and Meson, or you can generate a single-file version to drop directly into your project.
JsonCpp is licensed under the MIT license, meaning it can be used freely in both open and closed-source projects.
Where it fits
- Embed JSON parsing in a C++ application using a stable, widely packaged library.
- Store human-editable config files that preserve comments across reads and writes.
- Add JSON support to a C++ project via vcpkg, Conan, or a generated single-file drop-in.