json v3.1.0 Release Notes
Release Date: 2018-02-01 // about 6 years ago-
π Release date: 2018-02-01
SHA-256: d40f614d10a6e4e4e80dca9463da905285f20e93116c36d97d4dc1aa63d10ba4 (json.hpp), 2b7234fca394d1e27b7e017117ed80b7518fafbb4f4c13a7c069624f6f924673 (include.zip)Summary
This release adds support for the UBJSON format and JSON Merge Patch. It also contains some minor changes and bug fixes. All changes are backward-compatible.
π± β¨ New features
- The library now supports UBJSON (Universal Binary JSON Specification) as binary format to read and write JSON values space-efficiently. See the documentation overview for a comparison of the different formats CBOR, MessagePack, and UBJSON.
- π JSON Merge Patch (RFC 7386) offers an intuitive means to describe patches between JSON values (#876, #877). See the documentation of
merge_patch
for more information.
π± β‘οΈ Improvements
- The library now uses the Grisu2 algorithm for printing floating-point numbers (based on the reference implementation by Florian Loitsch) which produces a short representation which is guaranteed to round-trip (#360, #935, #936).
- The UTF-8 handling was further simplified by using the decoder of BjΓΆrn Hoehrmann in more scenarios.
π± π Reorganization
- Though the library is released as a single header, its development got more and more complicated. With this release, the header is split into several files and the single-header file
json.hpp
can be generated from these development sources. In the repository, folderinclude
contains the development sources andsingle_include
contains the singlejson.hpp
header (#700, #906, #907, #910, #911, #915, #920, #924, #925, #928, #944). - The split further allowed for a forward declaration header
include/nlohmann/json_fwd.hpp
to speed up compilation times (#314).
π± π¨ Further changes
- π Google Benchmark is now used for micro benchmarks (see
benchmarks
folder, #921). - β‘οΈ The serialization (JSON and binary formats) now properly work with the libraries string template parameter, allowing for optimized string implementations to be used in constraint environments such as embedded software (#941, #950).
- The exceptional behavior can now be overridden by defining macros
JSON_THROW_USER
,JSON_TRY_USER
, andJSON_CATCH_USER
, defining the behavior ofthrow
,try
andcatch
, respectively. This allows to switch off C++'s exception mechanism yet still execute user-defined code in case an error condition occurs (#938). - To facilitate the interplay with flex and Bison, the library does not use the variable name
yytext
any more as it could clash with macro definitions (#933). - The library now defines
NLOHMANN_JSON_VERSION_MAJOR
,NLOHMANN_JSON_VERSION_MINOR
, andNLOHMANN_JSON_VERSION_PATCH
to allow for conditional compilation based on the included library version (#943, #948). - π A compilation error with ICC has been fixed (#947).
- π Typos and links in the documentation have been fixed (#900, #930).
- π A compiler error related to incomplete types has been fixed (#919).
- β The tests form the UTF-8 decoder stress test have been added to the test suite.
π± π₯ Deprecated functions
- Function
iterator_wrapper
has been deprecated (#874). Since its introduction, the name was up for discussion, as it was too technical. We now introduced the member functionitems()
with the same semantics.iterator_wrapper
will be removed in the next major version (i.e., 4.0.0).
π Furthermore, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0):
friend std::istream& operator<<(basic_json&, std::istream&)
friend std::ostream& operator>>(const basic_json&, std::ostream&)
Please use
friend std::istream& operator>>(std::istream&, basic_json&)
andfriend operator<<(std::ostream&, const basic_json&)
instead.