Release JSON for Modern C++ version 3.11.3 ยท nlohmann/json
Release date: 2023-11-28
SHA-256: 9bea4c8066ef4a1c206b2be5a36302f8926f7fdc6087af5d20b417d0cf103ea6 (json.hpp), a22461d13119ac5c78f205d3df1db13403e58ce1bb1794edc9313677313f4a9d (include.zip), d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d (json.tar.xz)
Summary
This release fixes some bugs found in the 3.11.2 release.
All changes are backward-compatible.
๐ฐ Note you can support this project via GitHub sponsors or PayPal.
โจ New Features
- Allow custom base class as node customization point. This adds an additional template parameter which allows to set a custom base class for
nlohmann::json. This class serves as an extension point and allows to add functionality to json node. Examples for such functionality might be metadata or additional member functions (e.g., visitors) or other application specific code. By default the parameter is set tovoidand an empty base class is used. In this case the library behaves as it already did. #3110 - Add more specific parse error message when attempting to parse empty input. #4037 #4180
- Add serialization-only user defined type macros (
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZEandNLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE). #3816 - Add Bazel build support. If you are using Bazel you can simply reference this repository using
http_archiveorgit_repositoryand depend on@nlohmann_json//:json. #3709 - Support Apple's Swift Package Manager. #4010
๐ Bug Fixes
- Adjust CMake files to accept
NEWCMake policies up to CMake 3.14. This fixes a nasty deprecation warning that "Compatibility with CMake < 3.5 will be removed from a future version of CMake". #4076 #4112 - Fix CMake header path in install with custom
CMAKE_INSTALL_INCLUDEDIR. #4194 - Add missing
<numeric>header include. #3717 #3718 #3719 - Replace uses of
INT_MIN/INT_MAX, etc. withstd::numeric_limitsand consistently usestd-namespaced integer types to make library work with newer GCC versions. #3722 #3723 - Add missing files (
json_fwd.hppand Bazel build files) to release artifactinclude.zip. #3727 #3728 - Fix 'declaration hides global declaration' warning. #3751
- Fix natvis XML. #3858 #3863
- Fix warning about moved from object. #3805 #3889
- Remove a magic number to fix a warning. #3837 #3888
- Fix debug pretty-printer by checking if match is valid before accessing group. #3919 #3920
- Fix custom allocators by defining missing
rebindtype. #3895 #3927 - Prevent memory leak when exception is thrown in
adl_serializer::to_json#3881 #3901 - Fix Clang-Tidy warnings. #4047
- Fix init-list construction when
size_typeis notint. #4140 - Fix deprecation warning "identifier
_jsonpreceded by whitespace in a literal operator declaration". #4129 #4161 - Fix compile error with
_HAS_STATIC_RTTI=0. #4046 - Fix char_traits deprecation warning "
char_traits<unsigned char>is deprecated:char_traits<T>forTnot equal tochar,wchar_t,char8_t,char16_torchar32_tis non-standard". #4163 #4179
๐จ Further Changes
CI
- Use official Clang/GCC Docker containers in the CI. #3703
- Add workflow to check if the source files are amalgamated. #3693
- Fix CI build. #3724 #3862 #3978 #3985 #4025 #4083 #4160 #4196 #4215
- Use Clang 15. #3822 #3876
- Add CIFuzz CI GitHub action. #3845
- Fix MinGW script and CI. #3892 #4175
- Removed lgtm and DroneCI and added Cirrus CI. #3890 #3906 #3935 #3937
- Set minimal permissions to Github Workflows. #3971 #3972
- Refactor amalgamation workflow to avoid dangerous use of pull_request_target. #3945 #3969
Documentation
- Add migration guide to replace deprecated library functions. #3702 #3887
- Add dark mode toggle to documentation #3726
- Fix typos in documentation. #3748 #3767 #3902 #3932 #3951 #4109 #4126 #4143 #4149 #4159 #4173
- Update Codacy link. #3740
- Bump documentation tool versions. #3781 #3872 #3891 #3934
- Add vcpkg port version badge. #3988
- Add to
CONTRIBUTING.mdthatmake prettyis required for test updates. #4045 - Use template get instead of get in examples. #3827 #4038 #4039
- Capture exceptions by
const&in docs. #4099 - Fix source highlighting in user defined type macros docs. #4169
Tests
- Use
std::ranges::equalsfor range comparisons in test case. #3927 #3950 - Add more algorithm tests to
unit-algorithm.cpp. #4044
๐ฅ Deprecated functions
This release does not deprecate any function. See the migration guide for help adjusting your code for future versions.
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_wrapperis 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. - 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, callbasic_json::from_cbor(ptr, ptr+len)instead ofbasic_json::from_cbor({ptr, len}). - The implicit conversion from JSON Pointers to string (
json_pointer::operator string_t) is deprecated. Usejson_pointer::to_stringinstead. - Comparing JSON Pointers with strings via
operator==andoperator!=have been deprecated. To compare ajson_pointerpwith a strings, convertsto ajson_pointerfirst and usejson_pointer::operator==orjson_pointer::operator!=. #3684
All deprecations are annotated with HEDLEY_DEPRECATED_FOR to report which function to use instead.