Fix string_view ABI mismatch between library and consumers (#1661) The library was forced to build with CMAKE_CXX_STANDARD 11, so JSONCPP_HAS_STRING_VIEW was never defined at compile time. Consumers building with C++17 would see the string_view APIs in the header but fail to link them. Fix: - Remove the global CMAKE_CXX_STANDARD 11 override; the existing target_compile_features(cxx_std_11) already enforces the minimum. - Detect string_view support at configure time with check_cxx_source_compiles and export JSONCPP_HAS_STRING_VIEW as a PUBLIC compile definition on all library targets, so consumers always see the same value the library was built with. - Guard the __cplusplus fallback in value.h so it does not override the CMake-set define. Fixes #1595
JSON is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs.
JsonCpp is a C++ library that allows manipulating JSON values, including serialization and deserialization to and from strings. It can also preserve existing comment in deserialization/serialization steps, making it a convenient format to store user input files.
JsonCpp is a mature project in maintenance mode. Our priority is providing a stable, reliable JSON library for the long tail of C++ development.
JsonCpp remains a primary choice for developers who require comment preservation and support for legacy toolchains where modern C++ standards are unavailable. The library is intended to be a reliable dependency that does not require frequent updates or major migration efforts.
1.y.z (master): Actively maintained. Requires C++11.
0.y.z: Legacy support for pre-C++11 compilers. Maintenance is limited to critical security fixes.
00.11.z: Discontinued.
Major versions maintain binary compatibility. Critical security fixes are accepted for both the master and 0.y.z branches.
[!NOTE] Package manager ports (vcpkg, Conan, etc.) are community-maintained. Please report outdated versions or missing generators to their respective repositories.
Add jsoncpp to your vcpkg.json manifest:
{ "dependencies": ["jsoncpp"] }
Or install via classic mode: vcpkg install jsoncpp.
conan install --requires="jsoncpp/[*]" --build=missing
If you are using a conanfile.txt in a Conan 2 project, ensure you use the appropriate generators:
[requires] jsoncpp/[*] [generators] CMakeToolchain CMakeDeps
meson wrap install jsoncpp
[!NOTE] This approach may be outdated.
For projects requiring a single-header approach, see the Wiki entry.
Documentation is generated via Doxygen. Additional information is available on the Project Wiki.
JsonCpp is licensed under the MIT license, or public domain where recognized. See LICENSE for details.