Releases: nlohmann/json
Release list
JSON for Modern C++ version 3.10.0
Release date: 2021-08-17
SHA-256: 230f3a03cefd586661ebab577a347c973d97a770afb89e22c52abc3c2a19d0a7 (json.hpp), b5e3bfad07feba218a26a4f809fbb0d1e33450524bf5d7244cabc92cf8178c69 (include.zip)
Summary
JSON for Modern C++ 3.10.0 is the first release for over a year. It contains some new features and a lot of minor changes and bug fixes.
Most notably, it introduces extended diagnostics. By defining JSON_DIAGNOSTICS before including the json.hpp, a JSON Pointer is added to exceptions which helps to debug issues with object access, array indices, or mismatching types.
Another important change behind the curtains is a fully overworked CI which performs a lot of checks for every commit which should allow more frequent releases in the future.
All changes are backward-compatible.
💰 Note you can support this project via GitHub sponsors or PayPal.
✨ New Features
-
Add extended diagnostics information by adding a JSON Pointer to the exception messages indicating the exact location of a invalid type errors or out-of-bound errors.
[json.exception.type_error.302] (/address/housenumber) type must be number, but is stringExceptions in the library are thrown in the local context of the JSON value they are detected. This makes detailed diagnostics messages, and hence debugging, difficult. To create better diagnostics messages, each JSON value needs a pointer to its parent value such that a global context (i.e., a path from the root value to the value that lead to the exception) can be created. That global context is then provided as a JSON Pointer.
As this global context comes at the price of storing one additional pointer per JSON value and runtime overhead to maintain the parent relation, extended diagnostics are disabled by default. They can, however, be enabled by defining the preprocessor symbol
JSON_DIAGNOSTICSto 1 before includingjson.hpp. See thedocumentationfor more information. #932 #1508 #2562 #2838 #2866 -
Add a GDB pretty printer to facilitate reading
basic_jsonvalues in GDB. #1952 #2607 -
Add a new value
storeto the cbor_tag_handler_t which allows to store the tags of CBOR values as binary subtypes. #2863 #2908 -
Add support for containers with non-default-constructible types. #2574 #2576
🐛 Bug Fixes
- Fix a regression bug that failed
ordered_jsonto be used when exceptions were switched off. #2347 #2725 #2934 - Added iterator range insertion for
ordered_json. #2490 #2512 - Change the type of binary subtypes to
std::uint64_tto support subtypes >255. Furthermore, the return value of thesubtype()function has been fixed to the documented value-1in case no subtype is given. #2863 #2908 - Fix move constructor of internal
json_reftype which creatednullvalues when compiled with-fno-elide-constructors. #2387 #2405 - Fix the compilation of
input_adapterfor containers in edge cases. #2553 - Allow parsing from
std::bytecontainers. #2413 #2546 #2550 #2602 #2869 - Fix memory leak in
to_jsonin case a JSON value is reused. #2865 #2872 - Fix compilation error in case symbol
EOFwas not found. #2755 #2756 - Fix Compilation error when using
NLOHMANN_JSON_SERIALIZE_ENUMwithordered_jsonon libc++. #2491 #2825
Warnings
A lot of warnings have been fixed in this release. To make sure the library remains warning-free, the CI now breaks in case a warning is found in GCC (261 warning flags), Clang (flag -Weverything with 8 exceptions), or MSVC (flag /W4).
- Fix
-Wimplicit-fallthroughwarnings. #2348 #2349 - Fix
-Wfloat-equalwarnings. #2909 #2911 - Add assertions to suppress C28020 warnings. #2447
- Fix shadow warnings. #1759 #2536 #2444
- Fix compiler warnings in the test suite. #2537
- Fix issues found by Visual Studio Visual Assist #2615
- Fix unused parameter warning. #2646 #2658 #2668 #2706 #2707
- Remove HEDLEY annotation from
exception::what()to fix C28204 warning. #2673 #2680 - Suppress C4127 warning. #2592 #2875
- Fix truncation warning. #2572 #2874
- Fix useless cast warning. #1777 #2114 #2893 #2902
- Fix unknown pragma warning. #2924 #2925
- Fix
-Wswitch-enumwarnings. #2927 - Fix C4309 and C4100 warnings and treat all MSVC
/W4warnings as error. #2930 - Suppress fewer warning flags. #2936
⚡ Improvements
Tests and CI
The CI chain has been completely overworked and now runs mostly on a dedicated Docker Image that contains all relevant tools.
- Collected all CI calls in a CMake file which can be enabled by setting
JSON_CI. - Linux now builds with Clang 3.5 to 12 and GCC 4.8 to 11 checking multiple C++ standards. #2540
- Windows builds with MSVC 2015 to 2019, MinGW (GCC 8), Clang 11 and 12, and Clang-CL 11 checking multiple C++ standards.
- Mac builds with Xcode 10.2.1 to Xcode 12.4 checking multiple C++ standards. #1798 #2561 #2737 #2790 #2817
- Use static analysis tools Clang-Tidy, Cppcheck, Valgrind, Google Sanitizers, Clang Static Analyzer, Cpplint, and Facebook Infer.
- Add internal checks for CMake flags, switched off exceptions, header amalgamation, self-contained headers, and exclusion of certain tests via CTest.
- Providers: Move most Travis/AppVeyor builds to GitHub Actions. Use Drone CI for aarch64 build. Remove FOSSA. Properly select "Release" build for Travis CI builds. #2375 #2689
- Remove
#define private publichack from test files. Instead, macroJSON_PRIVATE_UNLESS_TESTEDis used in the source code which defaults toprivate, but can be set topublicto test internals. #43 #913 #1985 #2352
CMake
- Fixed issue in CMake file that overwrote
CMAKE_CXX_COMPILERwhen the test suite was compiled. #2344 #2384 - Only enable CMake options
JSON_BuildTestsandJSON_Installby default when the library is the main project. #2513 #2514 - Add CTest label
not_reproducibleto skip non-reproducible tests. #2324 #2560 - Formatted CMake files ##2770
- Add a CMake option
JSON_SystemIncludeto useSYSTEMintarget_include_directories. #2762 - Add CMake option
JSON_FastTests(OFFby default) to which slow test suite.
Documentation
- Fixed typos in the documentation. #2354 #2754
- Extended documentation for discarded values and
is_discarded()function. #2360 #2363 - Fix Markdown of README. #2582
- Fix example in README file. #2625 #2659
- Fix example in parse exceptions documentation. #2679
- Overworked documentation of number handling. #2747
- Add link to Conan Center package to README. #2771
- Added example for CPM.cmake. #2406
- Update README to use HTTPS everywhere. #2789
- Fixed consistency of
usingdeclarations in README. #2826 - Fix documentation of tests that required a Git checkout. #2845
- Fix code samples in GIF slideshow. #2457
- Update documentation to reference RFC 8259 as JSON standard.
- Add section on how to get support to README file.
- Replaced links to Doxygen documentation with new API documentation.
- Documented the effect of a bug in Microsoft's STL that makes
what()member function of exception objects unusable in case_HAS_EXCEPTIONS=0is set. #2824
Thirdparty
🔨 Further Changes
- Use C++14 constructs where available. #2533
- Fix
pkg-config.pcgeneration. #2690 - Add possibility to set the C++ standard via macros
JSON_HAS_CPP_11,JSON_HAS_CPP_14,JSON_HAS_CPP_17, andJSON_HAS_CPP_20. By defining any of these symbols, the internal check is overridden and the provided C++ version is unconditionally assumed. This can be helpful for compilers that only implement parts of the standard and would be detected incorrectly. #2730 #2731 #2749 - Add preprocessor symbol
JSON_NO_IO. When defined, headers<cstdio>,<ios>,<iosfwd>,<istream>, and<ostream>are not included and parse functions relying on these headers are excluded. This is relevant for environment where these I/O functions are disallowed for security reasons (e.g., Intel Software Guard Extensions (SGX)). #2728 #2729 #2842 #2861 - Benchmarks are handled via
FetchContentand require CMake version 3.11. Removed Google Benchmark copy. Fix default branch name for Google Benchmarks. #2795 #2796 - Simplify object parser for CBOR. #2879 #2598
- Cleaned up maintainer Makefiles
Licensing
- Clarified license of
is_complete_typeimplementation. #2534 - License fix for
integer_sequenceandindex_sequenceimplementation. #2683
🔥 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 inst...
JSON for Modern C++ version 3.9.1
Release date: 2020-08-06
SHA-256: 7804b38146921d03374549c9e2a5e3acda097814c43caf2b96a0278e58df26e0 (json.hpp), 6bea5877b1541d353bd77bdfbdb2696333ae5ed8f9e8cc22df657192218cad91 (include.zip)
Summary
This release fixes two bugs in the features introduced in release 3.9.0. The lexer did not accept consecutive comments, and ordered_json lacked some functions from json. All changes are backward-compatible.
💰 Note you can support this project via GitHub sponsors or PayPal.
🐛 Bug Fixes
- The lexer did not accept input with two or more consecutive comments (e.g.
/* one */ /* two */ []). #2330 #2332 - The newly introduced
ordered_jsoncontainer did not implement the complete interface ofbasic_jsonwhich broke existing code whenjsonwas replaced byordered_json, in particular when trying to callordered_json::parse. #2315 #2319 #2331
🔨 Further Changes
- Install pkg-config file to
CMAKE_CURRENT_BINARY_DIRinstead ofCMAKE_BINARY_DIR#2318 - Make installation directory of pkg-config file depend on
CMAKE_INSTALL_LIBDIR. #2314 - Fix
-Wimplicit-fallthroughwarning. #2333 - Fix name of Homebrew formula in documentation. #2326 #2327
- Fix typo in documentation. #2320
🔥 Deprecated functions
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_wrapperare 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.
JSON for Modern C++ version 3.9.0
Release date: 2020-07-27
SHA-256: d8089d52d285ef2c5368eb39ae665b39ea464206b1ca674a88a915c0245ff4f0 (json.hpp), 5b9b819aed31626aefe2eace23498cafafc1691890556cd36d2a8002f6905009 (include.zip)
JSON for Modern C++ 3.9.0 is a feature release that adds four long-awaited features, some requested five years ago.
- The parser functions have now an option to ignore
//and/* */style comments. Though comments are not officially part of the JSON specification (see here for a discussion), comment support was a frequently requested feature, and its implementation was much less effort than continuously explaining the lack of comment support. - The second-most requested feature was a way to preserve the insertion order of object keys. Though this was possible via template specialization for a while, we now added a new type
nlohmann::ordered_jsonas drop-in replacement fornlohmann::jsonfor this. - To circumvent unexpected behavior, implicit conversions can now be switched off with a CMake or preprocessor option.
- Last, but not least, a mapping between user-defined types and JSON can now be expressed using convenience macros by just listing the names of the member variables to read/write.
All changes are backward-compatible. See below the complete list of changes. See the README or the documentation for more information.
💰 Note you can support this project via GitHub sponsors or PayPal.
✨ New Features
- Add optional support for comments in JSON: passing parameter
ignore_commentsto theparsefunction will treat//and/* */comments like whitespace. #294 #363 #376 #597 #1513 #2061 #2212 - Add type
nlohmann::ordered_jsonto preserve insertion order of object keys.ordered_jsonis a specialization ofbasic_jsonand can be used whereverjsonis used. #106 #424 #543 #660 #727 #952 #1106 #1717 #1817 #2179 #2206 #2258 - Add CMake option
JSON_ImplicitConversionsand preprocessor symbolJSON_USE_IMPLICIT_CONVERSIONSto switch off implicit conversions. Implicit conversions, though very practical, are also a source of subtle bugs or unexpected behavior and may be switched off by default in future versions. The new options allow to remove implicit conversions now. #958 #1559 - Add convenience macros
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVEandNLOHMANN_DEFINE_TYPE_INTRUSIVEto simplify serialization/deserialization code for user-defined types. #2175 #2225 #2233 #2267 #2280 #2287 #2306 #2313 - Add high-precision number support for UBJSON. Now, any JSON value can serialized to UBJSON, and exception
json.exception.out_of_range.407will no longer occur for integers larger than 9223372036854775807 (LLONG_MAX). #2297 #2286 - Write binary subtype as CBOR tag. #2244
- Add option to ignore CBOR tags as alternative to treat them as invalid input. #2308 #2273 #1968
🐛 Bug Fixes
- Fix bug in CBOR parser where
allow_exceptionswas not respected. #2299 #2298 - Fix bug in CBOR parser where incomplete binary values or strings could crash the parser. #2293 #2294
⚡ Improvements
- Make code compile with Clang on Windows. #2259 #1119
- Use 32-bit float encoding in MessagePack wherever this is possible without loss of precision. #2201 #2196
- Replace
std::hash<nlohmann::basic_json>with a function that does not allocate memory. #2292 #2285 #2269
🔨 Further Changes
- Use GitLab Discussions for support and feature requests. Removed and adjusted issue templates accordingly.
- Allow CMake 3.13+ to override options when using
FetchContent. #2222 - Add support for pkg-config. #2253
- Add CMake option
JSON_TestDataDirectoryto select directory of previously downloaded test data for situations where Internet access is forbidden during testing. #2189 #2190 - Add option to skip tests that assume the code is checked out via Git. #2189
- Add
JSON_ASSERTmacro to control behavior of assert calls. #2242 - Add CI step for GitHub CodeQL analysis (GitHub actions).
- Add CI step for Clang 9 and Clang 10 on Windows (GitHub actions). #2259
- Add CI step for Clang 10 CL with MSVC 2019 on Windows (GitHub actions). #2268
- Clean up GitHub actions CI. #2300
- Add CI step for Xcode 12 (Travis). #2262
- Add CI step for explicit conversions (Travis, AppVeyor).
- Remove
swapspecialization to support C++20. #2176 - Add missing check for
binary()function in SAX interface. #2282 - Add test for CMake
target_include_directories. #2279 - Add test to use library in multiple translation units. #2301
- Add more sections to new project website. #2312
- Fix warnings. #2304 #2305 #2303 #2274 #2224 #2211 #2203
- Cleanup maintainer Makefiles. #2264 #2274
- Improve documentation. #2232
- Fix inconsistency in int-to-string function. #2193
🔥 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_wrapperare 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.
All deprecations are annotated with HEDLEY_DEPRECATED_FOR to report which function to use instead.
JSON for Modern C++ version 3.8.0
Release date: 2020-06-14
SHA-256: be7bbfbc7c62c35aa6f27dfbdd950384f247dd9f2281b5930bdaa3a6ab95eef7 (json.hpp), 8590fbcc2346a3eefc341935765dd57598022ada1081b425678f0da9a939a3c0 (include.zip)
Summary
It has been six months since the last release, and a lot of minor changes and bug fixes have accumulated. Nonetheless, JSON for Modern C++ 3.8.0 is a feature release.
-
With binary values we greatly extend the support for binary formats such as CBOR, BSON, or MessagePack. By adding a new value type to the JSON class, binary values can be read and written, and even shared between different formats. See the documentation for examples.
-
Furthermore, we overworked the input adapters; that is, the way input is read by the parsers. Now any container is supported via the
LegacyInputIteratorconcept. See the documentation for examples. At the same time, we could improve the performance by 3-10%.
All changes are backward-compatible. See below the complete list of changes.
💰 Note you can now support this project via GitHub sponsors or PayPal.
✨ New Features
- The library now supports binary values for CBOR (byte arrays), BSON, and MessagePack (bin, ext, fixext). The values are parsed into a byte vector for further processing. #483 #757 #1129 #1509 #1662 #1668 #2064 #2069 #2071 #2082 #2099
- The input adapters have been generalized to read from any container including user-defined containers via
LegacyInputIterator. The encoding of the input is implicitly derived from the size of the value type: UTF-8 (1 byte), UTF-16 (2 bytes), and UTF-32 (4 bytes) are supported. #1813 #2145 #2174 #2178 - CBOR now encodes floating-point numbers that can be represented by a
floatasfloatto save space in the serialization (32 bit va. 64 bit). #1719 #2044
🐛 Bug Fixes
- The functions to parse binary formats (
from_bson,from_cbor,from_msgpack, andfrom_ubjson) now properly respect theallow_exceptions=falseparameter. #1715 #2140 - The
containsfunction for JSON Pointers now returnsfalsein all cases a syntactically correct JSON Pointer refers to a non-existing value. Previously, an exception was raised if a JSON Pointer referred to an array, but did not consist of a number. #1942 #1982 #2019 - Fixed the JSON Pointer parser which accepted numbers with leading
+as array index. #1990 - Fixed JSON Patch generation to properly use
/-in theaddoperation for arrays. #1983 #2054 - Fixed compilation errors using GCC 10. #1912 #1920 #2034
- Fixed compilation errors using MSVC 2019. #1695 #1810 #1958 #2006 #2008 #2009
- Fixed a preprocessor check for some MSVC versions. #2112 #2137
- Fixed possible memory leak in
push_back. #1971 #2025 - Removed broken overload of the
value()function withjson::value_t typeparameter. #2086 #2104 - Removed values from arrays in case they are discarded by a parser callback function. Such values remained in the array with type
discardedbefore. #1972 #2153
⚡ Improvements
- The input adapters are now used via templates rather than inheriting from an abstract base class. This brings a 3-10% speedup for all parsers. #1457 #1950
- Test files are now downloaded from an external repository such that the code repository got much smaller and can be used as submodule more easily. #96 #482 #556 #567 #620 #732 #1066 #1184 #1185 #1235 #1497 #1572 #1790 #2081
- Made CMake's version config file architecture-independent. #1697 #1746
🔨 Further Changes
- Added links to GitHub sponsors and listed named sponsors.
- Documented the integration of the library via CMake FetchContent #2073 #2074
- Doozer CI was removed as it seems to exist no longer. #2080
- Added GitHub Actions workflows to build with Ubuntu, macOS, and Windows.
- Added GCC 10.1 to the continuous integration. #2136
- Fixed the Coveralls integration. #2100
- Fixed the error message for invalid surrogate pairs. #2076
- Fixed documentation. #1853 #1857 #1895 #1903 #1907 #1915 #1917 #1918 #1923 #1956 #1979 #1980 #2002 #2060 #2077 #2142 #2143 #2152
- Added test cases for NaN value in CBOR. #2043
- Documented curious behavior when using the library with glibc. #1924 #1933
- Fixed compiler warnings. #1939 #1911 #1967 #1969 #2049 #2051 #2053 #2113 #2116 #2144 #2177
- Updated Doctest to version 2.3.7. #2048 #2050
- Updated Hedley to version 13.
- Removed
std::is_podusage as it is deprecated in C++20. #1913 #2033 #2109 - Added wsjcpp package manager. #2004
- Added Build2 package manager. #1909
- Fixed compiler warning in test case. #1871
- Updated copyright year. #2010
- Updated CMake tests. #1844
- Removed a duplicated test. #2158
- Removed outdated Travis macOS images for Xcode 8.3, Xcode 9.0, Xcode 9.1, and Xcode 9.2. Added Xcode 11.2 image.
- Added FOSSA analysis.
- Header
<ciso646>is deprecated in C++17 and not included if library is compiled with C++17. #2089 .#2115 - Updated the templates for bug fix reports, feature requests, and questions.
- Added fuzz tests for the all UBJSON modes. #2182
- Used
HEDLEY_DEPRECATED_FORto indicate deprecated functions to have supporting compilers report which function to use instead.
🔥 Deprecated functions
This release deprecates 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. 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_wrapperare 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.
All deprecations are annotated with HEDLEY_DEPRECATED_FOR to report which function to use instead.
JSON for Modern C++ version 3.7.3
Release date: 2019-11-17
SHA-256: 3b5d2b8f8282b80557091514d8ab97e27f9574336c804ee666fda673a9b59926 (json.hpp), 87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014 (include.zip)
Summary
This release fixes a bug introduced in release 3.7.2 which could yield quadratic complexity in destructor calls. All changes are backward-compatible.
🐛 Bug Fixes
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.
JSON for Modern C++ version 3.7.2
Release date: 2019-11-10
SHA-256: 0a65fcbbe1b334d3f45c9498e5ee28c3f3b2428aea98557da4a3ff12f0f14ad6 (json.hpp), 67f69c9a93b7fa0612dc1b6273119d2c560317333581845f358aaa68bff8f087 (include.zip)
Summary
Project bad_json_parsers tested how JSON parser libraries react on deeply nested inputs. It turns out that this library segfaulted at a certain nesting depth. This bug was fixed with this release. Now the parsing is only bounded by the available memory. All changes are backward-compatible.
🐛 Bug Fixes
- Fixed a bug that lead to stack overflow for deeply nested JSON values (objects, array) by changing the implementation of the destructor from a recursive to an iterative approach. #832, #1419, #1835
🔨 Further Changes
- Added WhiteStone Bolt. #1830
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.
JSON for Modern C++ version 3.7.1
Release date: 2019-11-06
SHA-256: b5ba7228f3c22a882d379e93d08eab4349458ee16fbf45291347994eac7dc7ce (json.hpp), 77b9f54b34e7989e6f402afb516f7ff2830df551c3a36973085e2c7a6b1045fe (include.zip)
Summary
This release fixes several small bugs in the library. All changes are backward-compatible.
🐛 Bug Fixes
- Fixed a segmentation fault when serializing
std::int64_tminimum value. #1708 #1722 - Fixed the
contains()function for JSON Pointers. #1727 #1741 - Fixed too lax SFINAE guard for conversion from
std::pairandstd::tupletojson. #1805 #1806 #1825 #1826 - Fixed some regressions detected by UBSAN. Updated CI to use Clang-Tidy 7.1.0. #1716 #1728
- Fixed integer truncation in
iteration_proxy. #1797 - Updated Hedley to v11 to fix a E2512 error in MSVC. #1799
- Fixed a compile error in enum deserialization of non non-default-constructible types. #1647 #1821
- Fixed the conversion from
jsontostd::valarray.
⚡ Improvements
- The
items()function can now be used with a custom string type. #1765 - Made
json_pointer::backconst. #1764 #1769 - Meson is part of the release archive. #1672 #1694
- Improved documentation on the Meson and Spack package manager. #1694 #1720
🔨 Further Changes
- Added GitHub Workflow with
ubuntu-latest/GCC 7.4.0 as CI step. - Added GCC 9 to Travis CI to compile with C++20 support. #1724
- Added MSVC 2019 to the AppVeyor CI. #1780
- Added badge to fuzzing status.
- Fixed some cppcheck warnings. #1760
- Fixed several typos in the documentation. #1720 #1767 #1803
- Added documentation on the
JSON_THROW_USER,JSON_TRY_USER, andJSON_CATCH_USERmacros to control user-defined exception handling. - Used GitHub's CODEOWNERS and SECURITY feature.
- Removed
GLOBfrom CMake files. #1779 - Updated to Doctest 2.3.5.
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.
JSON for Modern C++ version 3.7.0
Release date: 2019-07-28
SHA-256: a503214947952b69f0062f572cb74c17582a495767446347ce2e452963fc2ca4 (json.hpp), 541c34438fd54182e9cdc68dd20c898d766713ad6d901fb2c6e28ff1f1e7c10d (include.zip)
Summary
This release introduces a few convenience functions and performs a lot of house keeping (bug fixes and small improvements). All changes are backward-compatible.
✨ New Features
- Add overload of the
containsfunction to check if a JSON pointer is valid without throwing exceptions, just like its counterpart for object keys. #1600 - Add a function
to_stringto allow for generic conversion to strings. #916 #1585 - Add return value for the
emplace_backfunction, returning a reference to the added element just like C++17 is introducing this forstd::vector. #1609 - Add info how to use the library with the pacman package manager on MSYS2. #1670
🐛 Bug Fixes
- Fix an issue where typedefs with certain names yielded a compilation error. #1642 #1643
- Fix a conversion to
std::string_viewin the unit tests. #1634 #1639 - Fix MSVC Debug build. #1536 #1570 #1608
- Fix
get_tomethod to clear existing content before writing. #1511 #1555 - Fix a
-Wc++17-extensionswarning.nodiscardattributes are now only used with Clang when-std=c++17is used. #1535 #1551
⚡ Improvements
- Switch from Catch to doctest for the unit tests which speeds up compilation and runtime of the 112,112,308 tests.
- Add an explicit section to the README about the frequently addressed topics character encoding, comments in JSON, and the order of object keys.
🔨 Further Changes
- Use
GNUInstallDirsto set library install directories. #1673 - Fix links in the README. #1620 #1621 #1622 #1623 #1625
- Mention
jsontype on the documentation start page. #1616 - Complete documentation of
value()function with respect totype_error.302exception. #1601 - Fix links in the documentation. #1598
- Add regression tests for MSVC. #1543 #1570
- Use CircleCI for continuous integration.
- Use Doozer for continuous integration on Linux (CentOS, Raspbian, Fedora)
- Add tests to check each CMake flag (
JSON_BuildTests,JSON_Install,JSON_MultipleHeaders,JSON_Sanitizer,JSON_Valgrind,JSON_NoExceptions,JSON_Coverage). - Use Hedley to avoid re-inventing several compiler-agnostic feature macros like
JSON_DEPRECATED,JSON_NODISCARD,JSON_LIKELY,JSON_UNLIKELY,JSON_HAS_CPP_14, orJSON_HAS_CPP_17. Functions taking or returning pointers are annotated accordingly when a pointer will not be null. - Build and run tests on AppVeyor in DEBUG and RELEASE mode.
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.
JSON for Modern C++ version 3.6.1
Release date: 2019-03-20
SHA-256: d2eeb25d2e95bffeb08ebb7704cdffd2e8fca7113eba9a0b38d60a5c391ea09a (json.hpp), 69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf (include.zip)
Summary
This release fixes a regression and a bug introduced by the earlier 3.6.0 release. All changes are backward-compatible.
🐛 Bug Fixes
- Fixed regression of #590 which could lead to compilation errors with GCC 7 and GCC 8. #1530
- Fixed a compilation error when
<Windows.h>was included. #1531
🔨 Further Changes
- Fixed a warning for missing field initializers. #1527
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.
JSON for Modern C++ version 3.6.0
Release date: 2019-03-20
SHA-256: ce9839370f28094c71107c405affb3b08c4a098154988014cbb0800b1c44a831 (json.hpp), 237c5e66e7f8186a02804ce9dbd5f69ce89fe7424ef84adf6142e973bd9532f4 (include.zip)
ℹ️ This release introduced a regression. Please update to version 3.6.1!
Summary
This release adds some convenience functions for JSON Pointers, introduces a contains function to check if a key is present in an object, and improves the performance of integer serialization. Furthermore, a lot of small bug fixes and improvements have been made. All changes are backward-compatible.
✨ New Features
- Overworked the public interface for JSON Pointers. The creation of JSON Pointers is simplified with
operator/andoperator/=. JSON Pointers can be inspected withempty,back, andparent_pointer, and manipulated withpush_backandpop_back. #1434 - Added a boolean method
containsto check whether an element exists in a JSON object with a given key. Returns false when called on non-object types. #1471 #1474
🐛 Bug Fixes
- Fixed a compilation issues with libc 2.12. #1483 #1514
- Fixed endian conversion on PPC64. #1489
- Fixed library to compile with GCC 9. #1472 #1492
- Fixed a compilation issue with GCC 7 on CentOS. #1496
- Fixed an integer overflow. #1447
- Fixed buffer flushing in serializer. #1445 #1446
⚡ Improvements
- The performance of dumping integers has been greatly improved. #1411
- Added CMake parameter
JSON_Installto control whether the library should be installed (default: on). #1330 - Fixed a lot of compiler and linter warnings. #1400 #1435 #1502
- Reduced required CMake version from 3.8 to 3.1. #1409 #1428 #1441 #1498
- Added
nodiscardattribute tometa(),array(),object(),from_cbor,from_msgpack,from_ubjson,from_bson, andparse. #1433
🔨 Further Changes
- Added missing headers. #1500
- Fixed typos and broken links in README. #1417 #1423 #1425 #1451 #1455 #1491
- Fixed documentation of parse function. #1473
- Suppressed warning that cannot be fixed inside the library. #1401 #1468
- Imroved package manager suppert:
- Continuous Integration
- Updated thirdparty libraries:
- Catch 1.12.0 -> 1.12.2
- Google Benchmark 1.3.0 -> 1.4.1
- Doxygen 1.8.15 -> 1.8.16
🔥 Deprecated functions
This release does not deprecate any functions. As an overview, 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_wrapperare 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.