Skip to content

Releases: nlohmann/json

JSON for Modern C++ version 3.4.0

30 Oct 21:22
e3c28af
Compare
Choose a tag to compare

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.

✨ 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 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

⚑ 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 as parse 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

πŸ”¨ Further Changes

  • improved Meson documentation #1305
  • fixed some more linter warnings #1280
  • fixed Clang detection for third-party Google Benchmark library #1277

πŸ”₯ 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):

JSON for Modern C++ version 3.3.0

05 Oct 11:00
f1768a5
Compare
Choose a tag to compare

Release date: 2018-10-05
SHA-256: f1327bb60c58757a3dd2b0c9c45d49503d571337681d950ec621f8374bcc14d4 (json.hpp), 9588d63557333aaa485e92221ec38014a85a6134e7486fe3441e0541a5a89576 (include.zip)

Summary

This release adds support for GCC 4.8. Furthermore, it adds a function get_to to write a JSON value to a passed reference. Another topic of this release was the CMake support which has been overworked and documented.

Besides, a lot of bugs have been fixed and slight improvements have been made. All changes are backward-compatible.

✨ New Features

  • The library can now also built with GCC 4.8. Though this compiler does not fully support C++11, it can successfully compile and run the test suite. Note that bug 57824 in GCC 4.8 still forbids to use multiline raw strings in arguments to macros. #1257
  • Added new function get_to to write a JSON value to a passed reference. The destination type is automatically derived which allows more succinct code compared to the get function. #1227 #1231

πŸ› Bug Fixes

  • Fixed a bug in the CMake file that made target_link_libraries to not properly include nlohmann_json. #1243 #1245 #1260
  • Fixed a warning in MSVC 2017 complaining about a constexpr if. #1204 #1268 #1272
  • Fixed a bug that prevented compilation with ICPC. #755 #1222
  • Improved the SFINAE correctness to fix a bug in the conversion operator. #1237 #1238
  • Fixed a -Wctor-dtor-privacy warning. #1224
  • Fixed a warning on a lambda in unevaluated context. #1225 #1230
  • Fixed a bug introduced in version 3.2.0 where defining JSON_CATCH_USER led to duplicate macro definition of JSON_INTERNAL_CATCH. #1213 #1214
  • Fixed a bug that prevented compilation with Clang 3.4.2 in RHEL 7. #1179 #1249

⚑ Improvements

  • Added documentation on CMake integration of the library. #1270
  • Changed the CMake file to use find_package(nlohmann_json) without installing the library. #1202
  • Improved error messages in case operator[] is used with the wrong combination (json.exception.type_error.305) of JSON container type and argument type. Example: "cannot use operator[] with a string argument". #1220 #1221
  • Added a license and version information to the Meson build file. #1252
  • Removed static assertions to indicated missing to_json or from_json functions as such assertions do not play well with SFINAE. These assertions also led to problems with GMock. #960 #1212 #1228
  • The test suite now does not wait forever if run in a wrong directory and input files are not found. #1262
  • The test suite does not show deprecation warnings for deprecated functions which frequently led to confusion. #1271

πŸ”¨ Further Changes

πŸ”₯ 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):

JSON for Modern C++ version 3.2.0

20 Aug 17:51
359f98d
Compare
Choose a tag to compare

Release date: 2018-08-20
SHA-256: ce6b5610a051ec6795fa11c33854abebb086f0fd67c311f5921c3c07f9531b44 (json.hpp), 35ee642558b90e2f9bc758995c4788c4b4d4dec54eef95fb8f38cb4d49c8fc7c (include.zip)

Summary

This release introduces a SAX interface to the library. While this may be a very special feature used by only few people, it allowed to unify all functions that consumed input and created some kind of JSON value. Internally, now all existing functions like parse, accept, from_cbor, from_msgpack, and from_ubjson use the SAX interface with different event processors. This allowed to separate the input processing from the value generation. Furthermore, throwing an exception in case of a parse error is now optional and up to the event processor. Finally, the JSON parser is now non-recursive (meaning it does not use the call stack, but std::vector<bool> to track the hierarchy of structured values) which allows to process nested input more efficiently.

Furthermore, the library finally is able to parse from wide string types. This is the first step toward opening the library from UTF-8 to UTF-16 and UTF-32.

This release further fixes several bugs in the library. All changes are backward-compatible.

✨ New Features

  • added a parser with a SAX interface (#971, #1153)
  • support to parse from wide string types std::wstring, std::u16string, and std::u32string; the input will be converted to UTF-8 (#1031)
  • added support for std::string_view when using C++17 (#1028)
  • allow to roundtrip std::map and std::unordered_map from JSON if key type is not convertible to string; in these cases, values are serialized to arrays of pairs (#1079, #1089, #1133, #1138)

πŸ› Bug Fixes

  • allow to create nullptr_t from JSON allowing to properly roundtrip null values (#1169)
  • allow compare user-defined string types (#1130)
  • better support for algorithms using iterators from items() (#1045, #1134)
  • added parameter to avoid compilation error with MSVC 2015 debug builds (#1114)
  • re-added accidentially skipped unit tests (#1176)
  • fixed MSVC issue with std::swap (#1168)

⚑ Improvements

  • key() function for iterators returns a const reference rather than a string copy (#1098)
  • binary formats CBOR, MessagePack, and UBJSON now supports float as type for floating-point numbers (#1021)

πŸ”¨ Further Changes

  • changed issue templates
  • improved continuous integration: added builders for Xcode 9.3 and 9.4, added builders for GCC 8 and Clang 6, added builder for MinGW, added builders for MSVC targeting x86
  • required CMake version is now at least 3.8 (#1040)
  • overworked CMake file wrt. packaging (#1048)
  • added package managers: Spack (#1041) and CocoaPods (#1148)
  • fixed Meson include directory (#1142)
  • preprocessor macro JSON_SKIP_UNSUPPORTED_COMPILER_CHECK can skip the rejection of unsupported compilers - use at your own risk! (#1128)
  • preprocessor macro JSON_INTERNAL_CATCH/JSON_INTERNAL_CATCH_USER allows to control the behavior of exception handling inside the library (#1187)
  • added note on char to JSON conversion
  • added note how to send security-related issue via encrypted email
  • removed dependency to std::stringstream (#1117)
  • added SPDX-License-Identifier
  • added updated JSON Parsing Test Suite, described in Parsing JSON is a Minefield πŸ’£
  • updated to Catch 1.12.0

πŸ”₯ 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):

JSON for Modern C++ version 3.1.2

14 Mar 20:50
d2dd27d
Compare
Choose a tag to compare

Release date: 2018-03-14
SHA-256: fbdfec4b4cf63b3b565d09f87e6c3c183bdd45c5be1864d3fcb338f6f02c1733 (json.hpp), 495362ee1b9d03d9526ba9ccf1b4a9c37691abe3a642ddbced13e5778c16660c (include.zip)

Summary

This release fixes several bugs in the library. All changes are backward-compatible.

πŸ› Bug Fixes

  • Fixed a memory leak occurring in the parser callback (#1001).
  • Different specializations of basic_json (e.g., using different template arguments for strings or objects) can now be used in assignments (#972, #977, #986).
  • Fixed a logical error in an iterator range check (#992).

⚑ Improvements

  • The parser and the serialization now support user-defined string types (#1006, #1009).

πŸ”¨ Further Changes

πŸ”₯ 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):

JSON for Modern C++ version 3.1.1

13 Feb 18:38
8968adc
Compare
Choose a tag to compare

Release date: 2018-02-13
SHA-256: e14ce5e33d6a2daf748026bd4947f3d9686ca4cfd53d10c3da46a0a9aceb7f2e (json.hpp), fde771d4b9e4f222965c00758a2bdd627d04fb7b59e09b7f3d1965abdc848505 (include.zip)

Summary

This release fixes several bugs in the library. All changes are backward-compatible.

πŸ› Bug Fixes

  • Fixed parsing of CBOR strings with indefinite length (#961). Earlier versions of this library misinterpreted the CBOR standard and rejected input with the 0x7F start byte.
  • Fixed user-defined conversion to vector type (#924, #969). A wrong SFINAE check rejected code though a user-defined conversion was provided.
  • Fixed documentation of the parser behavior for objects with duplicate keys (#963). The exact behavior is not specified by RFC 8259 and the library now also provides no guarantee which object key is stored.
  • Added check to detect memory overflow when parsing UBJSON containers (#962). The optimized UBJSON format allowed for specifying an array with billions of null elements with a few bytes and the library did not check whether this size exceeded max_size().

πŸ”¨ Further Changes

  • Code coverage is now calculated for the individual header files, allowing to find uncovered lines more quickly than by browsing through the single header version (#953, #957).
  • A Makefile target run_benchmarks was added to quickly build and run the benchmark suite.
  • The documentation was harmonized with respect to the header inclusion (#955). Now all examples and the README use #include <nlohmann/json.hpp> to allow for selecting single_include or include or whatever installation folder as include directory.
  • Added note on how to use the library with the cget package manager (#954).

πŸ”₯ 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):

JSON for Modern C++ version 3.1.0

01 Feb 23:08
97309f0
Compare
Choose a tag to compare

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, folder include contains the development sources and single_include contains the single json.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, and JSON_CATCH_USER, defining the behavior of throw, try and catch, 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, and NLOHMANN_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 function items() 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):

Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

JSON for Modern C++ version 3.0.1

29 Dec 19:26
ce1dccf
Compare
Choose a tag to compare

Release date: 2017-12-29
SHA-256: c9b3591f1bb94e723a0cd7be861733a3a555b234ef132be1e9027a0364118c4c

Summary

This release fixes small issues in the implementation of JSON Pointer and JSON Patch. All changes are backward-compatible.

Changes

  • πŸ› The "copy" operation of JSON Patch (RFC 6902) requests that it is an error if the target path points into a non-existing array or object (see #894 for a detailed description). This release fixes the implementation to detect such invalid target paths and throw an exception.
  • πŸ› An array index in a JSON Pointer (RFC 6901) must be an integer. This release fixes the implementation to throw an exception in case invalid array indices such as 10e2 are used.
  • βœ… Added the JSON Patch tests from Byron Ruth and Mike McCabe.
  • πŸ“ Fixed the documentation of the at(ptr) function with JSON Pointers to list all possible exceptions (see #888).
  • πŸ“ Updated the container overview documentation (see #883).
  • πŸ”§ The CMake files now respect the BUILD_TESTING option (see #846, #885)
  • 🚨 Fixed some compiler warnings (see #858, #882).

Deprecated functions

πŸ”₯ To unify the interfaces and to improve similarity with the STL, the following functions are deprecated since version 3.0.0 and will be removed in the next major version (i.e., 4.0.0):

Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

JSON for Modern C++ version 3.0.0

17 Dec 10:08
afebb6a
Compare
Choose a tag to compare

Release date: 2017-12-17
SHA-256: 076d4a0cb890a3c3d389c68421a11c3d77c64bd788e85d50f1b77ed252f2a462

Summary

After almost a year, here is finally a new release of JSON for Modern C++, and it is a major one! As we adhere to semantic versioning, this means the release includes some breaking changes, so please read the next section carefully before you update. But don't worry, we also added a few new features and put a lot of effort into fixing a lot of bugs and straighten out a few inconsistencies.

πŸ’₯ Breaking changes

This section describes changes that change the public API of the library and may require changes in code using a previous version of the library. In section "Moving from 2.x.x to 3.0.0" at the end of the release notes, we describe in detail how existing code needs to be changed.

  • The library now uses user-defined exceptions instead of re-using those defined in <stdexcept> (#244). This not only allows to add more information to the exceptions (every exception now has an identifier, and parse errors contain the position of the error), but also to easily catch all library exceptions with a single catch(json::exception).
  • When strings with a different encoding as UTF-8 were stored in JSON values, their serialization could not be parsed by the library itself, as only UTF-8 is supported. To enforce this library limitation and improve consistency, non-UTF-8 encoded strings now yield a json::type_error exception during serialization (#838). The check for valid UTF-8 is realized with code from BjΓΆrn Hoehrmann.
  • NaN and infinity values can now be stored inside the JSON value without throwing an exception. They are, however, still serialized as null (#388).
  • The library's iterator tag was changed from RandomAccessIterator to BidirectionalIterator (#593). Supporting RandomAccessIterator was incorrect as it assumed an ordering of values in a JSON objects which are unordered by definition.
  • The library does not include the standard headers <iostream>, <ctype>, and <stdexcept> any more. You may need to add these headers to code relying on them.
  • Removed constructor explicit basic_json(std::istream& i, const parser_callback_t cb = nullptr) which was deprecated in version 2.0.0 (#480).

πŸ”₯ Deprecated functions

To unify the interfaces and to improve similarity with the STL, the following functions are now deprecated and will be removed in the next major version (i.e., 4.0.0):

Please use friend std::istream& operator>>(std::istream&, basic_json&) and friend operator<<(std::ostream&, const basic_json&) instead.

✨ New features

With all this breaking and deprecation out of the way, let's talk about features!

  • We improved the diagnostic information for syntax errors (#301). Now, an exception json::parse_error is thrown which contains a detailed message on the error, but also a member byte to indicate the byte offset in the input where the error occurred.
  • We added a non-throwing syntax check (#458): The new accept function returns a Boolean indicating whether the input is proper JSON. We also added a Boolean parameter allow_exceptions to the existing parse functions to return a discarded value in case a syntax error occurs instead of throwing an exception.
  • An update function was added to merge two JSON objects (#428). In case you are wondering: the name was inspired by Python.
  • The insert function now also supports an iterator range to add elements to an object.
  • The binary exchange formats CBOR and MessagePack can now be parsed from input streams and written to output streams (#477).
  • Input streams are now only read until the end of a JSON value instead of the end of the input (#367).
  • The serialization function dump now has two optional parameters ensure_ascii to escape all non-ASCII characters with \uxxxx and an indent_char parameter to choose whether to indent with spaces or tabs (#654).
  • Added built-in type support for C arrays (#502), std::pair and std::tuple (#563, #614), enum and enum class (#545), std::vector<bool> (#494). Fixed support for std::valarray (#702), std::array (#553), and std::map<std::string, std::string> (#600, #607).

πŸ”¨ Further changes

Furthermore, there have been a lot of changes under the hood:

  • Replaced the re2c generated scanner by a self-coded version which allows for a better modularization of the parser and better diagnostics. To test the new scanner, we added millions (8,860,608 to be exact) of unit tests to check all valid and invalid byte sequences of the Unicode standard.
  • Google's OSS-Fuzz is still constantly fuzz-testing the library and found several issues that were fixed in this release (#497, #504, #514, #516, #518, #519, #575).
  • We now also ignore UTF-8 byte order marks when parsing from an iterator range (#602).
  • Values can be now moved from initializer lists (#663).
  • Updated to Catch 1.9.7. Unfortunately, Catch2 currently has some performance issues.
  • The non-exceptional paths of the library are now annotated with __builtin_expect to optimize branch prediction as long as no error occurs.
  • MSVC now produces a stack trace in MSVC if a from_json or to_json function was not found for a user-defined type. We also added a debug visualizer nlohmann_json.natvis for better debugging in MSVC (#844).
  • Overworked the documentation and added even more examples.
  • The build workflow now relies on CMake and CTest. Special flags can be chosen with CMake, including coverage (JSON_Coverage), compilation without exceptions (JSON_NoExceptions), LLVM sanitizers (JSON_Sanitizer), or execution with Valgrind (JSON_Valgrind).
  • Added support for package managers Meson (#576), Conan (#566), Hunter (#671, #829), and vcpkg (#753).
  • Added CI builders: Xcode 8.3, 9.0, 9.1, and 9.2; GCC 7.2; Clang 3.8, 3.9, 4.0, and 5.0; Visual Studio 2017. The library is further built with C++17 settings on the latest Clang, GCC, and MSVC version to quickly detect new issues.

Moving from 2.x.x to 3.0.0

User-defined Exceptions

There are five different exceptions inheriting from json::exception:

To support these exception, the try/catch blocks of your code need to be adjusted:

new exception previous exception
parse_error.101 invalid_argument
parse_error.102 invalid_argument
parse_error.103 invalid_argument
parse_error.104 invalid_argument
parse_error.105 invalid_argument
parse_error.106 domain_error
parse_error.107 domain_error
parse_error.108 domain_error
parse_error.109 invalid_argument
parse_error.110 out_of_range
parse_error.111 invalid_argument
parse_error.112 invalid_argument
invalid_iterator.201 domain_error
invalid_itera...
Read more

JSON for Modern C++ Version 2.1.1

25 Feb 16:07
9ff0cc0
Compare
Choose a tag to compare

Release date: 2017-02-25
SHA-256: faa2321beb1aa7416d035e7417fcfa59692ac3d8c202728f9bcc302e2d558f57

Summary

This release fixes a locale-related bug in the parser. To do so, the whole number handling (lexer, parser, and also the serialization) have been overworked. Furthermore, a lot of small changes added up that were added to this release. All changes are backward-compatible.

Changes

  • πŸ› Locales that have a different character than . as decimal separator (e.g., the Norwegian locale nb_NO.UTF-8) led to truncated number parsing or parse errors. The library now has been fixed to work with any locale. Note that . is still the only valid decimal separator for JSON input.
  • πŸ› Numbers like 1.0 were correctly parsed as floating-point number, but serialized as integer (1). Now, floating-point numbers correctly round trip.
  • πŸ› Parsing incorrect JSON numbers with leading 0 (0123) could yield a buffer overflow. This is fixed now by detecting such errors directly by the lexer.
  • πŸ› Constructing a JSON value from a pointer was incorrectly interpreted as a Boolean; such code will now yield a compiler error.
  • πŸ› Comparing a JSON number with 0 led to a comparison with null. This is fixed now.
  • πŸ› All throw calls are now wrapped in macros.
  • πŸ”’ Starting during the preparation of this release (since 8 February 2017), commits and released files are cryptographically signed with this GPG key. Previous releases have also been signed.
  • ✨ The parser for MessagePack and CBOR now supports an optional start index parameter to define a byte offset for the parser.
  • 🚨 Some more warnings have been fixed. With Clang, the code compiles without warnings with -Weverything (well, it needs -Wno-documentation-unknown-command and -Wno-deprecated-declarations, but you get the point).
  • πŸ”¨ The code can be compiled easier with many Android NDKs by avoiding macros like UINT8_MAX which previously required defining a preprocessor macro for compilation.
  • ⚑ The unit tests now compile two times faster.
  • βž• Cotire is used to speed up the build.
  • ✏️ Fixed a lot of typos in the documentation.
  • πŸ“ Added a section to the README file that lists all used third-party code/tools.
  • πŸ“ Added a note on constructing a string value vs. parsing.
  • βœ… The test suite now contains 11202597 unit tests.
  • πŸ“ Improved the Doxygen documentation by shortening the template parameters of class basic_json.
  • πŸ‘· Removed Doozer.
  • πŸ‘· Added Codacity.
  • ⬆️ Upgraded Catch to version 1.7.2.

JSON for Modern C++ Version 2.1.0

28 Jan 17:44
Compare
Choose a tag to compare
  • Release date: 2017-01-28
  • SHA-256: a571dee92515b685784fd527e38405cf3f5e13e96edbfe3f03d6df2e363a767b

Summary

This release introduces a means to convert from/to user-defined types. The release is backwards compatible.

conversion

Changes

  • ✨ The library now offers an elegant way to convert from and to arbitrary value types. All you need to do is to implement two functions: to_json and from_json. Then, a conversion is as simple as putting a = between variables. See the README for more information and examples.
  • ✨ Exceptions can now be switched off. This can be done by defining the preprocessor symbol JSON_NOEXCEPTION or by passing -fno-exceptions to your compiler. In case the code would usually thrown an exception, abort() is now called.
  • ✨ Information on the library can be queried with the new (static) function meta() which returns a JSON object with information on the version, compiler, and platform. See the documentation for an example.
  • πŸ› A bug in the CBOR parser was fixed which led to a buffer overflow.
  • ✨ The function type_name() is now public. It allows to query the type of a JSON value as string.
  • βœ… Added the Big List of Naughty Strings as test case.
  • ⬆️ Updated to Catch v1.6.0.
  • πŸ“ Some typos in the documentation have been fixed.