Skip to content

JSON for Modern C++ version 3.11.0

Compare
Choose a tag to compare
@nlohmann nlohmann released this 01 Aug 11:16
· 132 commits to develop since this release
499422b

πŸ› Unfortunately, this release introduced a bug that breaks existing usages of the user-defined string literals (UDL). This is fixed in version 3.11.1.


Release date: 2022-08-01
SHA-256: eb73896e9ce706ae6a62ce697dc8aca214840f70d8281779a6ea0cabe3afab3f (json.hpp), b4789050cacd110faf8b100cee82af19ad0b4d3249625f6582a60eeeb80c84a7 (include.zip), 5c8f7a4d9e9c0d565e71b6e5b0b3a12f784ffbf142e1ddc7ba86002cefb4c6ee (json.tar.xz)

Summary

Version 3.11.0 is one of the biggest releases (in terms of closed issues and merged pull requests) ever. It brings:

  • String view support for all functions working on object keys (e.g., at or operator[]), avoiding unnecessary allocations.
  • BJData as the fifth supported binary format besides BSON, CBOR, MessagePack, and UBJSON.
  • Better C++20 support to make the library integrate more smoothly with newer codebases.
  • Better support for avoiding problems when multiple versions of the library are used in the same project.
  • Even better and more extensive documentation and examples.
  • More tests for edge cases like 32-bit support, C++20 features, using the library with ICPC, or after including <windows.h>.

All changes are backward-compatible.

πŸ’° Note you can support this project via GitHub sponsors or PayPal.

✨ New Features

πŸ› Bug fixes

⚑ Improvements

Warnings

  • Fix ICPC warning 1098. #3632, #3634
  • Fix a -Wpragmas warning in GCC <11. #3550

πŸ”¨ Further Changes

CI

  • Add support for Visual Studio 2022., #3295
  • Adjust GitHub Actions CI wrt. windows-latest image. #3368
  • Remove deprecated windows-2016 image. #3416
  • Speed up AppVeyor CI. #3422
  • Update CI image to check with ICPC, GCC 11 and Clang 14. #3420
  • Add build step for ICPC to CI. #3465
  • Add more Xcode versions (13.3.1, 13.3, 13.2.1, 13.2, and 13.1) to the CI. #3485
  • Fix "JSON_MultipleHeaders" option spelling in CI. #3555
  • Increase timeout for Unicode tests. #3579, #3580, #3614
  • Abort CI runs on newer commits on the same branch. #3610
  • Fix MinGW CI failures. #3618
  • Disable exceptions on ICPC (for the disabled_exceptions unit test). #3621

Unit tests

Documentation and examples

πŸ”₯ Deprecated functions

The implicit conversion from JSON Pointers to string (json_pointer::operator string_t) has been deprecated. Use json_pointer::to_string instead.

The following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):

  • The function iterator_wrapper is deprecated. Please use the member function items() instead.
  • Functions friend std::istream& operator<<(basic_json&, std::istream&) and friend std::ostream& operator>>(const basic_json&, std::ostream&) are deprecated. Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.
  • Passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists is deprecated. Instead, pass two iterators; for instance, call basic_json::from_cbor(ptr, ptr+len) instead of basic_json::from_cbor({ptr, len}).

All deprecations are annotated with HEDLEY_DEPRECATED_FOR to report which function to use instead.