Skip to content

JSON for Modern C++ Version 2.1.1

Compare
Choose a tag to compare
@nlohmann nlohmann released this 25 Feb 16:07
· 3019 commits to develop since this release
9ff0cc0

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.