@nlohmann nlohmann released this Oct 5, 2018 · 23 commits to develop since this release

Assets 6

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


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):