v3.4.0
版本发布时间: 2018-10-31 05:22:13
nlohmann/json最新发布版本:v3.11.3(2023-11-29 05:38:09)
Release date: 2018-10-30 SHA-256: 63da6d1f22b2a7bb9e4ff7d6b255cf691a161ff49532dcc45d398a53e295835f (json.hpp), bfec46fc0cee01c509cf064d2254517e7fa80d1e7647fea37cf81d97c5682bdc (include.zip)
Summary
This release introduces three new features:
- BSON (Binary JSON) is next to CBOR, MessagePack, and UBJSON the fourth binary (de)serialization format supported by the library.
- Adjustable error handlers for invalid Unicode allows to specify the behavior when invalid byte sequences are serialized.
- Simplified enum/JSON mapping with a macro in case the default mapping to integers is not desired.
Furthermore, some effort has been invested in improving the parse error messages. Besides, a few bugs have been fixed. All changes are backward-compatible.
:sparkles: New Features
- The library can read and write a subset of BSON (Binary JSON). All data types known from JSON are supported, whereas other types more tied to MongoDB such as timestamps, object ids, or binary data are currently not implemented. See the README for examples. #1244 #1320
- The behavior when the library encounters an invalid Unicode sequence during serialization can now be controlled by defining one of three Unicode error handlers: (1) throw an exception (default behavior), (2) replace invalid sequences by the Unicode replacement character (U+FFFD), or (3) ignore/filter invalid sequences. See the documentation of the
dump
function for examples. #1198 #1314 - To easily specify a user-defined enum/JSON mapping, a macro
NLOHMANN_JSON_SERIALIZE_ENUM
has been introduced. See the README section for more information. #1208 #1323
:bug: Bug Fixes
- fixed truncation #1286 #1315
- fixed an issue with std::pair #1299 #1301
- fixed an issue with std::variant #1292 #1294
- fixed a bug in the JSON Pointer parser
:zap: Improvements
- The diagnosis messages for parse errors have been improved: error messages now indicated line/column positions where possible (in addition to a byte count) and also the context in which the error occurred (e.g., "while parsing a JSON string"). Example: error
parse error at 2: syntax error - invalid string: control character must be escaped; last read: '<U+0009>'
is now reported asparse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \u0009 or \t; last read: '<U+0009>'
. #1280 #1288 #1303
:hammer: Further Changes
- improved Meson documentation #1305
- fixed some more linter warnings #1280
- fixed Clang detection for third-party Google Benchmark library #1277
:fire: 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_wrapper
are 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.
1、 include.zip 131.92KB
2、 include.zip.asc 833B
3、 json.hpp 689.38KB
4、 json.hpp.asc 833B