JSON for Modern C++ version 3.12.0 #4731
nlohmann
announced in
Announcements
Replies: 1 comment
-
|
Thanks a lot for the release! This seem to break users of json_sax_dom_parser as it now requires to explicitly specify the Could you please clarify if providing string_input_adapter_type is the correct way to preserve old behavior? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Release date: 2025-04-11
SHA-256: aaf127c04cb31c406e5b04a63f1ae89369fccde6d8fa7cdda1ed4f32dfc5de63 (json.hpp), b8cb0ef2dd7f57f18933997c9934bb1fa962594f701cd5a8d3c2c80541559372 (include.zip), 42f6e95cad6ec532fd372391373363b62a14af6d771056dbfc86160e6dfff7aa (json.tar.xz)
Summary
This release fixes some bugs found in the 3.11.3 release and adds some new features.
All changes are backward-compatible.
💰 Note you can support this project via GitHub sponsors or PayPal.
Key updates and enhancements
JSON_DIAGNOSTIC_POSITIONS, introduces member functions to query the byte positions of values in the input they were parsed from. When enabled, this information is also included in exceptions to help pinpoint errors. json start/end position implementation #4517 Retrieving raw text from subobjects #4455 fix diagnostic positions related compilation errors #4570 Compilation issue with cmake option "JSON_Diagnostic_Positions" ON #4569 fix the abi tests for diagnostics positions feature #4572 Couple of ABI tests failed upon enabling JSON_Diagnostic_Positions cmake option #4571 add a ci step for Json_Diagnostic_Positions #4579 use diagnostic positions in exceptions #4585 Use diagnostic positions in exceptions #4561json,ordered_json, and any otherbasic_jsonspecialization. Generate template functions with NLOHMANN_DEFINE_TYPE macros #4597 Cannot assign from ordered_json vector<CustomStruct> to value in not ordered json #2528 nlohmann::ordered_json: not compatible with NLOHMANN_DEFINE_TYPE_INTRUSIVE #4377 Templated versions of NLOHMANN_DEFINE_TYPE_INTRUSIVE and NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE #2532 Add templated version of DEFINE_TYPE macros #2843ordered_jsondoesn't support construction from C array of custom type #3810 Add regression test for #3810 #4608NLOHMANN_DEFINE_DERIVED_TYPE_*macros. Add NLOHMANN_DEFINE_DERIVED_TYPE_* macros #4033 How to Serialize derived class to JSON object? #2199 Add ONLY_SERIALIZE for NLOHMANN_DEFINE_DERIVED_TYPE_* macros #4562std::optional: The library now supports conversions from/tostd::optionaltypes when compiled with C++17. [C++17] Allow std::optional to convert to nlohmann::json #1749 feat: Rebasefeature/optionaltodevelop#4036patch,diff, andflattennow work with arbitrary string types. Allow patch and diff to be used with arbitrary string types #4536 patch_inplace assumes StringType is std::string #4134 fix compilation issue #4613 flatten() function does not compile if an alternative string type is used #4019get_numberfunction used in the binary format implementations has been optimized to read multiple bytes at once. Optimize binaryget_numberimplementation by reading multiple bytes at once #4391std::filesystem::pathare now encoded to UTF-8 strings by default on all operating systems. to_json(std::filesystem::path) can create invalid UTF-8 chars on windows #4271 Make std::filesystem::path conversion to/from UTF-8 encoded string explicit #4631Changes and fixes
iteration_proxyis now astd::forward_iteratorinstead of just anstd::input_iterator. This allows more use cases whenitems()is fed into C++20std::views. The iterator always satisfied all requirements for a forward iterator, but was exposed as only an input iterator by the used iterator tag. iteration_proxy has limited usefulness in C++20 range views #4371 Make iterator_proxy_value a forward_iterator (#4371) #4372to_jsonis erroneously converting enums with underlying unsigned types to signed numbers #4236 Fixto_jsonfor enums when the enum has an unsigned underlying type. #4237m_dataadded. Fix gdb pretty printer #4343 gdb-pretty-print broken since m_data added #4309basic_json. Update natvis to reflect 3.11.3 and the current structure of basic_json #4451 Structure declared in natvis file template doesn't seem to match current structure ofbasic_json<>#4438 Structure declared in natvis file template doesn't seem to match current structure ofbasic_json<>#4438nullptrtoparsefunction expectingFILE*. Instead, now an exception is thrown. Crash when parsing nullptr #4485 Possible fix for #4485 #4487EINTRset inerrno. fix: integer parsed as float when EINTR set in errno #4506number_floatto be locale-independent. Make SAX output locale-independent #4505 SAX interface unexpectedly gets locale-altered float representation. #4084get_ptrfor unsigned integers. Fix return value of get_ptr for unsigned integers #4525 Invalid union access for get_ref/get_ptr with unsigned integer #4475EOFwithchar_traits. Replace EOF with char_traits #4532NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULTthrow an exception with an empty json NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT throw an exception with an empty json #4507 Fix NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT with an empty JSON instance #4508[]instead ofnull. Serialize empty tuple into '[]' instead of null #4594 Emptystd::tuple<>cannot be serialized and de-serialized #4530Warnings
The quality assurance page gives an overview of the warning flags used during the tests.
Compiler warnings
weak-vtableswarning for exceptions. Fix weak-vtables warning #4500 Getting a weak-vtables warning with clang on ubuntu 22.04 #4087Clang-Tidy
modernize-use-std-numbers,readability-redundant-member-init, andbugprone-unused-local-non-trivial-variable. Suppress Clang-Tidy warnings #4276modernize-type-traitsandmodernize-avoid-c-arraysinNLOHMANN_JSON_SERIALIZE_ENUM. Suppress warnings in NLOHMANN_JSON_SERIALIZE_ENUM #4497modernize-avoid-c-arraysclang-tidy warning when usingNLOHMANN_JSON_SERIALIZE_ENUMmacro #3924boost-use-rangesas we do not want to rely on Boost. Another desperate try to fix the CI #4489modernize-use-designated-initializersas designated initializers are a C++20 feature. Another desperate try to fix the CI #4489modernize-use-rangesas ranges are a C++20 feature. Another desperate try to fix the CI #4489clang-analyzer-webkit.NoUncountedMemberCheckeras we are using pointers internally. Suppress clang-analyzer-webkit.NoUncountedMemberChecker #4701modernize-use-integer-sign-comparison. Suppress modernize-use-integer-sign-comparison #4558Build
CMake
NLOHMANN_JSON_TARGET_NAME. Allow overriding the CMake target name #4483Package Managers
alwayslink=TrueBazel flag. Remove alwayslink=True Bazel flag #4396Package.swiftdefinition file. Add VisionOS support to Swift Package Manager Package.swift definition file #4611CI
Tests
JSON_DisableEnumSerialization=ON. Skip enum tests when JSON_DisableEnumSerialization=ON #4504 JSON_BuildTests fail when JSON_DisableEnumSerialization is set to ON #4384Infrastructure
macos-11image; the following Xcode versions are no longer tested in the CI: '11.7', '12.4', '12.5.1', '13.0'. Another desperate try to fix the CI #4489macos-13image to test Xcode versions '14.2', '14.3', '14.3.1', '15.0.1', '15.1', '15.2'. Another desperate try to fix the CI #4489macos-14image to test Xcode versions '15.3', '15.4'. Another desperate try to fix the CI #4489macos-15image to test Xcode versions '16.0', '16.1'. Another desperate try to fix the CI #4489json-ciimage as these versions are no longer work on the respectivegccimages (checkout fails). Another desperate try to fix the CI #4489ubuntu-latestimage to run Valgrind. Use ubuntu-latest image to run Valgrind #4575requirements.txtfiles for cppcheck, cpplint, and reuse to central location. Clean up CI #4553.lgtm.ymlfile. Clean up and document project files #4560ubuntu-latestmore often and reduce dependencies to more exotic containers. Clean up and document project files #4560.pre-commit-config.ymlfile. Clean up and document project files #4560tests/thirdparty/imapdl/filterbr.py. Clean up and document project files #4560Indentation and amalgamation
make amalgamate#4275 Overwork astyle call #4573Documentation
The documentation website contains all project documentation.
Fixed documentation
update()#4307 #4307 Updated docx to 3.10.5 from 3.10.4 #4310Custom data sourceexample. #4335json_pointer.md#4255operator_{gt,le,lt}.md#4412 Fix typo in nlohmann_define_derived_type.md #4565 Correct typo in sax_interface.md #4679 Update documentation #4723ci_test_api_documentationCI step. Overwork documentation #4516Added documentation
FILES.md. Clean up and document project files #4560start_posandend_pos. Clean up and document project files #4560valuefunction. Add note on derived return type for value function #4628 basic_json::operator[key] and basic_json::value(key) return different values #4626JSON_DIAGNOSTIC_POSITIONSto macro feature page. Some documentation updates #4636Improved documentation
parseandacceptwith respect to Crash when parsing nullptr #4485 Possible fix for #4485 #4487 Overwork documentation #4516Package Manager documentation
Documentation implementation
plantumlbinary package #4026This discussion was created from the release JSON for Modern C++ version 3.12.0.
Beta Was this translation helpful? Give feedback.
All reactions