JSON for Modern C++ version 3.10.5
Release date: 2022-01-03
SHA-256: e832d339d9e0c042e7dff807754769d778cf5d6ae9730ce21eed56de99cb5e86 (json.hpp), b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e (include.zip)
Summary
The previous version 3.10.4 introduced support to convert std::filesystem
objects to JSON and vice versa. Unfortunately, we made the assumption that any compiler supporting C++17 would also have proper filesystem support. This was a mistake. This release introduces preprocessor checks (and means to override them) to make sure that the conversion support is only compiled if the compiler is detected to support it.
All changes are backward-compatible.
💰 Note you can support this project via GitHub sponsors or PayPal.
🐛 Bug fixes
- Make sure C++17 filesystem conversions are only used if the compiler supports it. Furthermore, add defines
JSON_HAS_FILESYSTEM
andJSON_HAS_EXPERIMENTAL_FILESYSTEM
which can be set to0
to avoid using filesystem support altogether.std::filesystem
. #3090 #3097 #3101 #3156 #3203 - Fix a compilation error with Nvidia CUDA Compiler (NVCC). #3013 #3234
Warnings
- Fix a warning for shadowed variables. #3188 #3193
- Fix a warning on a pointless comparison. #3227 #2712 #2676 #1390 #755
⚡ Improvements
- Add a parameter to the
update
function to recursively merge objects with common keys. #3006 #3069 - Extend
std::hash
andstd::swap
to work on anynlohmann::basic_json
specializations rather than justnlohmann::json
. #3121
🔨 Further Changes
Tests and CI
- Update CI to use Clang 14, GCC 6, and Clang-Tidy 14. #3088
- Update cpplint. #3225
- Add build step for the Nvidia CUDA Compiler (NVCC). #3227
- Remove Travis CI. #3087 #3233
- Compile and execute the test suite with C++17. #3101
Documentation
- The mkdocs-based documentation in doc/mkdocs has been totally overworked. It now has a unified structure, more examples, and contains all information from the previous Doxygen-based documentation. The single source of truth is now the documentation on https://json.nlohmann.me and in particular the API Documentation. #3071
- Removed Wandbox online examples. #3071
- Fix typos, links, and parameter names in the documentation. #3102 #3125 #3140 #3145 #3148
- Add more examples. #3071 #3100
🔥 Deprecated functions
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})
.
The following functions have been deprecated in earlier versions and will be removed in the next major version (i.e., 4.0.0):
- Function
iterator_wrapper
are deprecated. Please use the member functionitems()
instead. - Functions
friend std::istream& operator<<(basic_json&, std::istream&)
andfriend std::ostream& operator>>(const basic_json&, std::ostream&)
are deprecated. Please usefriend std::istream& operator>>(std::istream&, basic_json&)
andfriend operator<<(std::ostream&, const basic_json&)
instead.
All deprecations are annotated with HEDLEY_DEPRECATED_FOR
to report which function to use instead.