Nlohmann-json

Latest version: v3.11.3

Safety actively analyzes 688724 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 8

3.11.3

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](https://github.com/nlohmann/json/releases/tag/v3.11.2) release.

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).

:sparkles: New Features

- Allow [**custom base class**](https://json.nlohmann.me/api/basic_json/json_base_class_t/) 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 to `void` and 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**](https://json.nlohmann.me/features/macros/) (`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE` and `NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE`). #3816
- Add **Bazel** build support. If you are using [Bazel](https://bazel.build/) you can simply reference this repository using `http_archive` or `git_repository` and depend on `nlohmann_json//:json`. #3709
- Support Apple's Swift Package Manager. 4010

:bug: Bug Fixes

- Adjust CMake files to accept `NEW` **CMake 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. with `std::numeric_limits` and consistently use `std`-namespaced integer types to make library work with newer GCC versions. 3722 3723
- Add missing files (`json_fwd.hpp` and Bazel build files) to release artifact `include.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 `rebind` type. 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_type` is not `int`. 4140
- Fix deprecation warning "identifier `_json` preceded 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>` for `T` not equal to `char`, `wchar_t`, `char8_t`, `char16_t` or `char32_t` is non-standard". 4163 4179

:hammer: Further Changes

CI

- Use official [Clang](https://github.com/silkeh/docker-clang)/[GCC](https://hub.docker.com/_/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](https://google.github.io/oss-fuzz/getting-started/continuous-integration/) CI GitHub action. #3845
- Fix MinGW script and CI. 3892 4175
- Removed lgtm and DroneCI and added [Cirrus CI](https://cirrus-ci.org). #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**](https://json.nlohmann.me/integration/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.md` that `make pretty` is 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::equals` for range comparisons in test case. 3927 3950
- Add more algorithm tests to `unit-algorithm.cpp`. 4044

:fire: Deprecated functions

This release does not deprecate any function. See the [**migration guide**](https://json.nlohmann.me/integration/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_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})`.
- The implicit conversion from JSON Pointers to string ([`json_pointer::operator string_t`](https://json.nlohmann.me/api/json_pointer/operator_string_t)) is deprecated. Use [`json_pointer::to_string`](https://json.nlohmann.me/api/json_pointer/to_string/) instead.
- Comparing JSON Pointers with strings via [`operator==`](https://json.nlohmann.me/api/json_pointer/operator_eq/) and [`operator!=`](https://json.nlohmann.me/api/json_pointer/operator_ne/) have been deprecated. To compare a [`json_pointer`](https://json.nlohmann.me/api/json_pointer/) `p` with a string `s`, convert `s` to a `json_pointer` first and use [`json_pointer::operator==`](https://json.nlohmann.me/api/json_pointer/operator_eq/) or [`json_pointer::operator!=`](https://json.nlohmann.me/api/json_pointer/operator_ne/). #3684

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.

3.11.2

Release date: 2022-08-12
SHA-256: 665fa14b8af3837966949e8eb0052d583e2ac105d3438baba9951785512cf921 (json.hpp), e5c7a9f49a16814be27e4ed0ee900ecd0092bfb7dbfca65b5a421b774dccaaed (include.zip), 8c4b26bf4b422252e13f332bc5e388ec0ab5c3443d24399acb675e68278d341f (json.tar.xz)

Summary

This release fixes some bugs found in the [3.11.1](https://github.com/nlohmann/json/releases/tag/v3.11.1) release. Furthermore, the []((https://json.nlohmann.me/features/namespace/)) of the namespace library has been re-structured.

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).

:bug: Bug Fixes

- Fix the [`value`](https://json.nlohmann.me/api/basic_json/value/) function which was broken for strings, size types, and `nullptr` in release 3.11.0. #3652 3655 3663
- Fix the `json_fwd.hpp` header to be self-contained and add it to the single-header release. 3656 3679 3687
- Fix regression that broke using [`json_pointer`](https://json.nlohmann.me/api/json_pointer/) as key in associative containers. #3680 3685
- Add missing constraint to deprecated JSON Pointer overloads of [`contains`](https://json.nlohmann.me/api/basic_json/contains/) and [`at`](https://json.nlohmann.me/api/basic_json/at/). #3658 3681
- Fix comparison between [`json_pointer`](https://json.nlohmann.me/api/json_pointer/) and strings with `==` and `!=`. These comparisons worked in 3.10.5, but were broken in 3.11.0 and 3.11.1. #3654 3664
- Fix `to_json` conversion of `std::vector<bool>::reference` and `std::vector<bool>::const_reference` for STLs where these are the same as `basic_json::boolean_t&` and `basic_json::boolean_t`, respectively. 3677 3678

:zap: Improvements

- Restructure inline namespace and allow version component to be disabled. See [documentation](https://json.nlohmann.me/features/namespace/). #3683 3696 3697 3698
- Avoid heap allocations in [BJData](https://json.nlohmann.me/features/binary_formats/bjdata/) parser. #3637

:hammer: Further Changes

Documentation

- Publish documentation on every push to `develop` branch. 3660 3673
- Add missing examples for the [public API](https://json.nlohmann.me/api/basic_json/). #3672 3686
- Fix typo in [`json_pointer`](https://json.nlohmann.me/api/json_pointer/) documentation. #3692

Community

- Add a badge for the [Discord chat](https://discord.gg/6mrGXKvX7y) to the README file. The goal of that additional communication channel beyond [the existing ones](https://github.com/nlohmann/json#support) is to quickly coordinate between the contributors. 3651
- Complete contributor list. 3662 3670

CI

- Remove the `macos-10.15` image from the CI as it is removed by GitHub Actions. 3612 3615 3626
- Remove hardcoded paths in Ubuntu workflow. 3626
- Only trigger AppVeyor builds if relevant files have been changed. 3626
- Fix CodeQL warning. 3626
- Harmonize naming of GitHub Actions jobs. 3661
- Add labeler action to automatically add PR labels based on the changed files. 3671 3674 3675
- Lint API documentation in the CI. 3672
- Add local [LGTM](http://lgtm.com) configuration and suppress warnings on third-party scripts. #3643

:fire: Deprecated functions

- This release deprecates comparing JSON Pointers with strings via [`operator==`](https://json.nlohmann.me/api/json_pointer/operator_eq/) and [`operator!=`](https://json.nlohmann.me/api/json_pointer/operator_ne/). To compare a [`json_pointer`](https://json.nlohmann.me/api/json_pointer/) `p` with a string `s`, convert `s` to a `json_pointer` first and use [`json_pointer::operator==`](https://json.nlohmann.me/api/json_pointer/operator_eq/) or [`json_pointer::operator!=`](https://json.nlohmann.me/api/json_pointer/operator_ne/). #3684

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})`.
- The implicit conversion from JSON Pointers to string ([`json_pointer::operator string_t`](https://json.nlohmann.me/api/json_pointer/operator_string_t)) is deprecated. Use [`json_pointer::to_string`](https://json.nlohmann.me/api/json_pointer/to_string/) instead.

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.

3.11.1

Release date: 2022-08-01
SHA-256: 9279dc616aac67efce68967f118051b50236612b90572e059783d368bd78687e (json.hpp), 9c15ca7806f863872452bfbc85fee6d1c9868117e3ea5e00a204ae961a2e1ae7 (include.zip), e6dd39f8f2da9cab11de2212acdd40b1cc1aafbe09da8c92933b911d19da3302 (json.tar.xz)

Known issues

- 3652 Regression: call to member function 'value' is ambiguous
- 3654 Regression: no match for 'operator!=' comparing json_pointer and const char */string_t
- 3655 Regression: .value<size_t> is compilation error

All issues are fixed in the `develop` branch and will be part of the [3.11.2](https://github.com/nlohmann/json/releases/tag/v3.11.2) release.

Summary

[Version 3.11.0](https://github.com/nlohmann/json/releases/tag/v3.11.0) moved the user-defined string literals (UDL) into namespace `nlohmann::literals::json_literals` (see [documentation](https://json.nlohmann.me/api/macros/json_use_global_udls/)). Unfortunately, this namespace was not imported to the global namespace by default which broke code. This release fixes this bug.

All changes are backward-compatible. See [release notes of version 3.11.0](https://github.com/nlohmann/json/releases/tag/v3.11.0) for more information on other features.

:moneybag: Note you can **support this project** via [GitHub sponsors](https://github.com/sponsors/nlohmann) or [PayPal](https://paypal.me/nlohmann).

:bug: Bug fixes

- Set default value of [`JSON_USE_GLOBAL_UDLS`](https://json.nlohmann.me/api/macros/json_use_global_udls/) and the CMake options `JSON_GlobalUDLs` to `1` to import the user-defined string literals from the `nlohmann::literals::json_literals` namespace into the global namespace by default. #3644 3645 3646

3.11.0

- **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).

:sparkles: New Features

- 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

:bug: Bug fixes

- 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

:zap: Improvements

- 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

Warnings

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

:hammer: Further Changes

- 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

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`](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

:fire: Deprecated functions

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.

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.

:moneybag: Note you can **support this project** via [GitHub sponsors](https://github.com/sponsors/nlohmann) or [PayPal](http://paypal.me/nlohmann).

:bug: Bug fixes

- Make sure C++17 filesystem conversions are only used if the compiler supports it. Furthermore, add defines [`JSON_HAS_FILESYSTEM` and `JSON_HAS_EXPERIMENTAL_FILESYSTEM`](https://json.nlohmann.me/features/macros/#json_has_cpp_11-json_has_cpp_14-json_has_cpp_17-json_has_cpp_20) which can be set to `0` 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

:zap: Improvements

- Add a parameter to the [`update`](https://json.nlohmann.me/api/basic_json/update/) function to recursively merge objects with common keys. #3006 3069
- Extend [`std::hash`](https://json.nlohmann.me/api/basic_json/std_hash/#version-history) and [`std::swap`](https://json.nlohmann.me/api/basic_json/std_swap/) to work on any `nlohmann::basic_json` specializations rather than just `nlohmann::json`. #3121

:hammer: 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](https://www.mkdocs.org)-based documentation in [doc/mkdocs](https://github.com/nlohmann/json/tree/develop/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**](https://json.nlohmann.me/api/basic_json/). #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

:fire: 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`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a0a8051760196ac813fd5eb3c8d5a2976.html#a0a8051760196ac813fd5eb3c8d5a2976) are deprecated. Please use the member function [`items()`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5961446010dfc494e0c247b4e9026977.html#a5961446010dfc494e0c247b4e9026977) instead.
- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html#a60ca396028b8d9714c6e10efbf475af6) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html#a34d6a60dd99e9f33b8273a1c8db5669b) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead.

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.

3.10.4

Release date: 2021-10-16
SHA-256: c9ac7589260f36ea7016d4d51a6c95809803298c7caec9f55830a0214c5f9140 (json.hpp), 62c585468054e2d8e7c2759c0d990fd339d13be988577699366fe195162d16cb (include.zip)

Summary

This release fixes two bugs introduced in release 3.10.0 and fixes the conversion of `std::filesystem::path`. All changes are backward-compatible.

:moneybag: Note you can **support this project** via [GitHub sponsors](https://github.com/sponsors/nlohmann) or [PayPal](http://paypal.me/nlohmann).

:bug: Bug Fixes

- Fix regression bug introduced in release 3.10.0 which broke compilation for types with an explicit default constructor with default arguments. 3077 3079
- Fix regression bug introduced in release 3.10.0 which treated the return values of `std::find` and `std::remove` as pointers which could break compilation. 3081 3082
- Fix converting `std::filesystem::path` to JSON. Before release 3.10.3, such a conversion would trigger a stack overflow. Release 3.10.3 then further broke compilation on Windows. 3070 3073

:fire: 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`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a0a8051760196ac813fd5eb3c8d5a2976.html#a0a8051760196ac813fd5eb3c8d5a2976) are deprecated. Please use the member function [`items()`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5961446010dfc494e0c247b4e9026977.html#a5961446010dfc494e0c247b4e9026977) instead.
- Functions [`friend std::istream& operator<<(basic_json&, std::istream&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a60ca396028b8d9714c6e10efbf475af6.html#a60ca396028b8d9714c6e10efbf475af6) and [`friend std::ostream& operator>>(const basic_json&, std::ostream&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a34d6a60dd99e9f33b8273a1c8db5669b.html#a34d6a60dd99e9f33b8273a1c8db5669b) are deprecated. Please use [`friend std::istream& operator>>(std::istream&, basic_json&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_aaf363408931d76472ded14017e59c9e8.html#aaf363408931d76472ded14017e59c9e8) and [`friend operator<<(std::ostream&, const basic_json&)`](https://nlohmann.github.io/json/doxygen/classnlohmann_1_1basic__json_a5e34c5435e557d0bf666bd7311211405.html#a5e34c5435e557d0bf666bd7311211405) instead.

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.

Page 1 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.