tag name | v3.11.0 (fc7fa42dd1db86e7ba9ee39a6acd43795af5cdb5) |
tag date | 2022-09-25 15:57:53 +0300 |
tagged by | ArthurSonzogni <sonzogniarthur@gmail.com> |
tagged object | commit 4a0e5870a0... |
* * *
**: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](https://github.com/nlohmann/json/releases/tag/v3.11.1).**
* * *
Release date: 2022-08-01
SHA-256: eb73896e9ce706ae6a62ce697dc8aca214840f70d8281779a6ea0cabe3afab3f (json.hpp), b4789050cacd110faf8b100cee82af19ad0b4d3249625f6582a60eeeb80c84a7 (include.zip), 5c8f7a4d9e9c0d565e71b6e5b0b3a12f784ffbf142e1ddc7ba86002cefb4c6ee (json.tar.xz)
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`](https://json.nlohmann.me/api/basic_json/at/) or [`operator[]`](https://json.nlohmann.me/api/basic_json/operator%5B%5D/)), 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](https://github.com/sponsors/nlohmann) or [PayPal](https://paypal.me/nlohmann).
- Allow to **use `std::string_view` as object keys** in [`at`](https://json.nlohmann.me/api/basic_json/at/), [`operator[]`](https://json.nlohmann.me/api/basic_json/operator%5B%5D/), [`value`](https://json.nlohmann.me/api/basic_json/value/), [`erase`](https://json.nlohmann.me/api/basic_json/erase/), [`find`](https://json.nlohmann.me/api/basic_json/find/), [`contains`](https://json.nlohmann.me/api/basic_json/contains/), and [`count`](https://json.nlohmann.me/api/basic_json/count/) to avoid unnecessary allocations. #3423, #1529, #3558, #3564
- Add support to read and write the UBJSON-derived **[Binary JData (BJData)](https://github.com/NeuroJSON/bjdata/blob/Draft_2/Binary_JData_Specification.md) format** (see [documentation](https://json.nlohmann.me/features/binary_formats/bjdata/)). #3336, #3461, #3463, #3475, #3479, #3493, #3491, #3492, #3490, #3500, #3502, #3503, #3505, #3513, #3514, #3519, #3523, #3541, #3543
- Allow creation of [`ordered_json`](https://json.nlohmann.me/api/ordered_json/) objects from initializer lists. #3342, #3343, #3370
- Fix failing tests when compiling with C++20 and add support for [`operator<=>`](https://json.nlohmann.me/api/basic_json/operator_spaceship/). #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 like `float`. #3409, #3446
- Add [`operator<<(json_pointer)`](https://json.nlohmann.me/api/operator_ltlt/) 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
- Allow default values for [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](https://json.nlohmann.me/api/macros/nlohmann_define_type_intrusive/) and [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](https://json.nlohmann.me/api/macros/nlohmann_define_type_non_intrusive/). #2819, #3143
- Avoid clash with Arduino defines. #3338
- Improve [`meta`](https://json.nlohmann.me/api/basic_json/meta/) output for MSVC. #3417
- Check and warn if a different version of the library is already included (see [`JSON_SKIP_LIBRARY_VERSION_CHECK`](https://json.nlohmann.me/api/macros/json_skip_library_version_check/)). #3418
- Re-template [`json_pointer`](https://json.nlohmann.me/api/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`](https://json.nlohmann.me/api/basic_json/patch_inplace/) function to apply patches without copying. #3581, #3596
- Use [`swap`](https://json.nlohmann.me/api/basic_json/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`](https://json.nlohmann.me/api/macros/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`](https://json.nlohmann.me/api/macros/json_use_global_udls/)) to avoid name clashes. #1682, #3605
- Fix ICPC warning 1098. #3632, #3634
- Fix a `-Wpragmas` warning in GCC <11. #3550
- Fix `_MSC_VER` version to check for `std::filesystem`. #3240
- Remove `<sstream>` dependency. #3239, #3244
- Overwork bug template to systematically request information. #3348
- Add script to [test local version](https://github.com/nlohmann/json/tree/develop/tools/serve_header) in Compiler Explorer. #3456
- Change the default value of the CMake parameter `JSON_MultipleHeader` to `ON` to always use the multi-header version unless specified otherwise. #3532
- Add option to disable default enum conversions (see [`JSON_DISABLE_ENUM_SERIALIZATION`](https://json.nlohmann.me/api/macros/json_disable_enum_serialization/)). #3536
- Add maintainer targets to create source archive `json.tar.xz` which can be used in [`FetchContent`](https://json.nlohmann.me/integration/cmake/#fetchcontent). #3289, #3255
- Fix `CITATION.cff`. #3320
- Use [The Pitchfork Layout (PFL)](https://api.csswg.org/bikeshed/?force=1&url=https://raw.githubusercontent.com/vector-of-bool/pitchfork/develop/data/spec.bs). #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](http://reuse.software). #3546 , #3633, #3635
- Install `.pc` and `.cmake` files to `share` directory. #3619
- 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
- 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
- Add more examples to documentation. #3464
- Improve documentation on supported types of [`parse`](https://json.nlohmann.me/api/basic_json/parse/) and [`accept`](https://json.nlohmann.me/api/basic_json/accept/). #3245, #3246
- Add documentation on [how to parse JSON Lines](https://json.nlohmann.me/features/parsing/json_lines/) input. #3247
- Fix typos. #3249, #3265, #3426, #3439, #3481, #3499
- Document [parsing to `ordered_json`](https://json.nlohmann.me/features/object_order/#notes-on-parsing). #3325, #3326
- Use `FetchContent_MakeAvailable` in examples. #3345, #3351
- Document [requirement](https://json.nlohmann.me/api/macros/json_diagnostics/#notes) of using the same definition of `JSON_DIAGNOSTICS` in all linked objects. #3360, #3378
- Document [fuzz testing](https://github.com/nlohmann/json/blob/develop/tests/fuzzing.md). #3477, #3478
- Add documentation of [macros](https://json.nlohmann.me/api/macros/) and [runtime assertions](https://json.nlohmann.me/features/assertions/). #3444, #3431
- Fix documentation of [JSON Pointer](https://json.nlohmann.me/features/json_pointer/). #3511, #3520
- Make certain usage patterns more prominent in the README. #3557
- Document [precondition](https://json.nlohmann.me/api/basic_json/parse/#notes) for parsing from `FILE *` and add assertion. #3593
- Improve documentation. #3592
- Add documentation for [comparing `json` and `ordered_json`](https://json.nlohmann.me/api/basic_json/operator_eq/#notes). #3443, #3599
- Adjust JSON Pointer examples and add CI step for the examples. #3622
- Overwork documentation and add more examples. #3553
The implicit conversion from JSON Pointers to string ([`json_pointer::operator string_t`](https://json.nlohmann.me/api/json_pointer/operator_string_t)) has been deprecated. Use [`json_pointer::to_string`](https://json.nlohmann.me/api/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()`](https://json.nlohmann.me/api/basic_json/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&)`](https://json.nlohmann.me/api/operator_gtgt/) and [`friend operator<<(std::ostream&, const basic_json&)`](https://json.nlohmann.me/api/operator_ltlt/) 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`](https://nemequ.github.io/hedley/api-reference.html#HEDLEY_DEPRECATED_FOR) to report which function to use instead.