chore: remove leftover CMake checks for std::string_view (#1676)

* ci: suppress Node 20 deprecation and missing python-version warnings

- Injects `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true` in all workflows to
  opt-in to Node.js 24 and suppress the deprecation warnings from
  multiple GitHub Actions.
- Specifies `python-version: '3.x'` for `actions/setup-python@v5` in
  `meson.yml` to fix the missing input warning.

* Fix C++11 ABI breakage when compiled with C++17 (#1668)

When JSONCPP_HAS_STRING_VIEW was defined, the library dropped the
`const char*` and `const String&` overloads for `operator[]`, `get`,
`removeMember`, and `isMember`, breaking ABI compatibility for projects
consuming the library with C++11.

This change unconditionally declares and defines the legacy overloads
so they are always exported, restoring compatibility.

* ci: add ABI compatibility matrix workflow

This adds a new GitHub Actions workflow to verify ABI compatibility across C++ standard boundaries. It explicitly tests the scenario where JsonCpp is built with one standard (e.g., C++11) and consumed by an application built with a newer one (e.g., C++23), and vice versa.

To facilitate testing the specific `std::string_view` boundary that is conditionally compiled, a new `stringView` demo application has been added to the `example/` directory and is consumed directly by the CI matrix to ensure standard library symbols link correctly across standard versions, build types (shared/static), and operating systems.

* fix: inline std::string_view methods to prevent ABI breaks

This commit completely eliminates the ABI breakage that occurs across C++ standard boundaries when using `std::string_view`.

Previously, when the library was built with C++17+, CMake would leak `JSONCPP_HAS_STRING_VIEW=1` as a PUBLIC definition. A C++11 consumer would receive this definition, attempt to parse the header, and fail with compiler errors because `std::string_view` is not available in their environment.

Conversely, if the library was built in C++11 (without `string_view` symbols), a C++17 consumer would naturally define `JSONCPP_HAS_STRING_VIEW` based on `__cplusplus` inside `value.h`. The consumer would then call the declared `string_view` methods, resulting in linker errors because the methods weren't compiled into the library.

By moving all `std::string_view` overloads directly into `value.h` as `inline` methods that delegate to the fundamental `const char*, const char*` methods:
1. The consumer's compiler dictates whether the overloads are visible (via `__cplusplus >= 201703L`).
2. The consumer compiles the inline wrappers locally, removing any reliance on the library's exported symbols for `std::string_view`.
3. CMake no longer needs to pollute the consumer's environment with PUBLIC compile definitions.

* run clang format

* finish clang format

* chore: remove leftover CMake checks for std::string_view

Fixes #1669

This removes the final vestige of the JSONCPP_HAS_STRING_VIEW build system logic.

As of the previous commit (inlining std::string_view methods into value.h to fix ABI breaks), the library no longer relies on the build system (CMake or Meson) to check for and define JSONCPP_HAS_STRING_VIEW.

The header value.h automatically activates std::string_view overloads purely by checking the consumer`s __cplusplus >= 201703L. Since none of the actual std::string_view symbols are compiled into the .so / .a library anymore, Meson (and CMake) builds are identical regardless of whether string_view is supported by the compiler building the library.

* format spacing better
2 files changed
tree: 0ad7c9b4b646f6139a32425e5086a802b873783e
  1. .github/
  2. cmake/
  3. devtools/
  4. doc/
  5. example/
  6. include/
  7. pkg-config/
  8. src/
  9. test/
  10. .clang-format
  11. .clang-tidy
  12. .gitattributes
  13. .gitignore
  14. amalgamate.py
  15. appveyor.yml
  16. AUTHORS
  17. BUILD.bazel
  18. CMakeLists.txt
  19. CONTRIBUTING.md
  20. CTestConfig.cmake
  21. dev.makefile
  22. doxybuild.py
  23. gcovr.cfg
  24. get_version.pl
  25. jsoncpp-namespaced-targets.cmake
  26. jsoncppConfig.cmake.in
  27. jsoncppConfig.cmake.meson.in
  28. LICENSE
  29. meson.build
  30. meson_options.txt
  31. MODULE.bazel
  32. README.md
  33. reformat.sh
  34. SECURITY.md
  35. version.in
README.md

JsonCpp

Conan Center badge badge Coverage Status

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.

Project Status

JsonCpp is a mature project in maintenance mode. Our priority is providing a stable, reliable JSON library for the long tail of C++ development.

Current Focus

  • Security: Addressing vulnerabilities and fuzzing results.
  • Compatibility: Ensuring the library builds without warnings on the latest versions of GCC, Clang, and MSVC.
  • Reliability: Fixing regressions and critical logical bugs.

Out of Scope

  • Performance: We are not competing with SIMD-accelerated or reflection-based parsers.
  • Features: We are generally not accepting requests for new data formats or major API changes.

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.

A note on backward-compatibility

  • 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.

Integration

[!NOTE] Package manager ports (vcpkg, Conan, etc.) are community-maintained. Please report outdated versions or missing generators to their respective repositories.

vcpkg

Add jsoncpp to your vcpkg.json manifest:

{
  "dependencies": ["jsoncpp"]
}

Or install via classic mode: vcpkg install jsoncpp.

Conan

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

meson wrap install jsoncpp

Amalgamated source

[!NOTE] This approach may be outdated.

For projects requiring a single-header approach, see the Wiki entry.

Documentation

Documentation is generated via Doxygen. Additional information is available on the Project Wiki.

License

JsonCpp is licensed under the MIT license, or public domain where recognized. See LICENSE for details.