v3.11.0
版本发布时间: 2022-08-01 19:16:37
nlohmann/json最新发布版本:v3.11.3(2023-11-29 05:38:09)
:bug: 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
oroperator[]
), 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.
:moneybag: Note you can support this project via GitHub sponsors or PayPal.
:sparkles: New Features
- Allow to use
std::string_view
as object keys inat
,operator[]
,value
,erase
,find
,contains
, andcount
to avoid unnecessary allocations. #3423, #1529, #3558, #3564 - Add support to read and write the UBJSON-derived Binary JData (BJData) format (see documentation). #3336, #3461, #3463, #3475, #3479, #3493, #3491, #3492, #3490, #3500, #3502, #3503, #3505, #3513, #3514, #3519, #3523, #3541, #3543
:bug: Bug fixes
- Allow creation of
ordered_json
objects from initializer lists. #3342, #3343, #3370 - Fix failing tests when compiling with C++20 and add support for
operator<=>
. #3207, #3446, #3472 - Fix comparison-related compilation problems in C++20 on GCC 12. #3138, #3379
- Make iterator satisfy
std::incrementable
. #3331, #3332 - Exclude
std::any
from implicit conversion. #3428, #3437 - Fix constraints on
from_json()
for strings. #3171, #3267, #3312, #3384, #3427, #3312, #3620 - Make iterators usable with
<ranges>
and range-v3. #3130, #3446 - Fix comparison of NaN values with
json
to behave likefloat
. #3409, #3446 - Add
operator<<(json_pointer)
to fix a regression after the 3.10.0 release. #3600, #3601 - Fix JSON Patch to not create missing parent objects. #3134, #3199, #3628
- Re-add
value_type
detection to distinguish string types (was broken in releases 3.10.4, and 3.10.5). #3204, #3333, #3604, #3602, #3629 - Fix latest build error in MSVC platform (was broken during development of 3.11.0). #3630
:zap: Improvements
- Allow default values for
NLOHMANN_DEFINE_TYPE_INTRUSIVE
andNLOHMANN_DEFINE_TYPE_NON_INTRUSIVE
. #2819, #3143 - Avoid clash with Arduino defines. #3338
- Improve
meta
output for MSVC. #3417 - Check and warn if a different version of the library is already included (see
JSON_SKIP_LIBRARY_VERSION_CHECK
). #3418 - Re-template
json_pointer
on string type. #3415 - Allow to create booleans from
std::vector<bool>::reference
. #3533, #3534 - Allow to use array types where iterators are pointers. #3544
- Improve performance of writing binary formats to byte vectors. #3569
- Add
patch_inplace
function to apply patches without copying. #3581, #3596 - Use
swap
by ADL to allow swapping with non-std
containers and improve error messages. #3609 - Add versioned, ABI-tagged inline namespace (see
NLOHMANN_JSON_NAMESPACE
) to avoid ODR errors when linking different versions of the library. #1539, #3360, #3588, #3590 - Move UDLs out of the global namespace (see
JSON_USE_GLOBAL_UDLS
) to avoid name clashes. #1682, #3605
Warnings
- Fix ICPC warning 1098. #3632, #3634
- Fix a
-Wpragmas
warning in GCC <11. #3550
:hammer: Further Changes
- Fix
_MSC_VER
version to check forstd::filesystem
. #3240 - Remove
<sstream>
dependency. #3239, #3244 - Overwork bug template to systematically request information. #3348
- Add script to test local version in Compiler Explorer. #3456
- Change the default value of the CMake parameter
JSON_MultipleHeader
toON
to always use the multi-header version unless specified otherwise. #3532 - Add option to disable default enum conversions (see
JSON_DISABLE_ENUM_SERIALIZATION
). #3536 - Add maintainer targets to create source archive
json.tar.xz
which can be used inFetchContent
. #3289, #3255 - Fix
CITATION.cff
. #3320 - Use The Pitchfork Layout (PFL). #3462
- Update Cpplint. #3454
- More intermediate folders from Visual Studio Code are added to
.gitignore
. #3572 - Add badge for https://repology.org/project/nlohmann-json/versions. #3586
- Use REUSE licensing framework. #3546 , #3633, #3635
- Install
.pc
and.cmake
files toshare
directory. #3619
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
- Improve unit tests. #3380, #3393, #3365, #3405, #3377, #3421, #3422
- Disable regression test on GCC <8.4. #3451
- Add tests for 32 bit. #3524, #3529, #3530, #3532
- Add error message if test suite cannot be found. #3584, #3585
- Add unit test to make sure
iterator_input_adapter
advances iterators correctly. #3548 - Add a unit test including
<windows.h>
. #3631
Documentation and examples
- Add more examples to documentation. #3464
- Improve documentation on supported types of
parse
andaccept
. #3245, #3246 - Add documentation on how to parse JSON Lines input. #3247
- Fix typos. #3249, #3265, #3426, #3439, #3481, #3499
- Document parsing to
ordered_json
. #3325, #3326 - Use
FetchContent_MakeAvailable
in examples. #3345, #3351 - Document requirement of using the same definition of
JSON_DIAGNOSTICS
in all linked objects. #3360, #3378 - Document fuzz testing. #3477, #3478
- Add documentation of macros and runtime assertions. #3444, #3431
- Fix documentation of JSON Pointer. #3511, #3520
- Make certain usage patterns more prominent in the README. #3557
- Document precondition for parsing from
FILE *
and add assertion. #3593 - Improve documentation. #3592
- Add documentation for comparing
json
andordered_json
. #3443, #3599 - Adjust JSON Pointer examples and add CI step for the examples. #3622
- Overwork documentation and add more examples. #3553
:fire: 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 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})
.
All deprecations are annotated with HEDLEY_DEPRECATED_FOR
to report which function to use instead.
1、 include.zip 284.38KB
2、 include.zip.asc 833B
3、 json.hpp 875.48KB
4、 json.hpp.asc 833B
5、 json.tar.xz 105.85KB
6、 json.tar.xz.asc 833B