ArduinoJson 6.8.0-beta
* Import functions in the ArduinoJson namespace to get clearer errors
* Improved syntax highlighting in Arduino IDE
* Removed default capacity of `DynamicJsonDocument`
* `JsonArray::copyFrom()` accepts `JsonArrayConst`
* `JsonVariant::set()` accepts `JsonArrayConst` and `JsonObjectConst`
* `JsonDocument` was missing in the ArduinoJson namespace
* Added `memoryUsage()` to `JsonArray`, `JsonObject`, and `JsonVariant`
* Added `nesting()` to `JsonArray`, `JsonDocument`, `JsonObject`, and `JsonVariant`
* Replaced `JsonDocument::nestingLimit` with an additional parameter

Looking for a human-readable version? 📰 Read the article on arduinojson.org

Special note

ArduinoJson 6 requires updating code written for version 5. See the migration guide for details.

Changes since 6.7.0-beta

  • Import functions in the ArduinoJson namespace to get clearer errors
  • Improved syntax highlighting in Arduino IDE
  • Removed default capacity of DynamicJsonDocument
  • JsonArray::copyFrom() accepts JsonArrayConst
  • JsonVariant::set() accepts JsonArrayConst and JsonObjectConst
  • JsonDocument was missing in the ArduinoJson namespace
  • Added memoryUsage() to JsonArray, JsonObject, and JsonVariant
  • Added nesting() to JsonArray, JsonDocument, JsonObject, and JsonVariant
  • Replaced JsonDocument::nestingLimit with an additional parameter to deserializeJson() and deserializeMsgPack()
  • Fixed uninitialized variant in JsonDocument
  • Fixed StaticJsonDocument copy constructor and copy assignment
  • The copy constructor of DynamicJsonDocument chooses the capacity according to the memory usage of the source, not from the capacity of the source.
  • Added the ability to create/assign a StaticJsonDocument/DynamicJsonDocument from a JsonArray/JsonObject/JsonVariant
  • Added JsonDocument::isNull()
  • Added JsonDocument::operator[]
  • Added ARDUINOJSON_TAB to configure the indentation character
  • Reduced the size of the pretty JSON serializer
  • Added add(), createNestedArray() and createNestedObject() to JsonVariant
  • JsonVariant automatically promotes to JsonObject or JsonArray on write. Calling JsonVariant::to<T>() is not required anymore.
  • JsonDocument now support the same operations as JsonVariant. Calling JsonDocument::as<T>() is not required anymore.
  • Fixed example JsonHttpClient.ino
  • User can now use a JsonString as a key or a value

View version history

BREAKING CHANGES

DynamicJsonDocument's constructor

The parameter to the constructor of DynamicJsonDocument is now mandatory

Old code:

DynamicJsonDocument doc;

New code:

DynamicJsonDocument doc(1024);

Nesting limit

JsonDocument::nestingLimit was replaced with a new parameter to deserializeJson() and deserializeMsgPack().

Old code:

doc.nestingLimit = 15;
deserializeJson(doc, input);

New code:

deserializeJson(doc, input, DeserializationOption::NestingLimit(15));

How to install

There are several ways to install ArduinoJson, from simpler to more complex:

  1. Use the Arduino Library Manager
  2. Download ArduinoJson-v6.8.0-beta.h put it in your project folder
  3. Download ArduinoJson-v6.8.0-beta.zip and extract it in you libraries folder

Note: ArduinoJson-v6.8.0-beta.h are ArduinoJson-v6.8.0-beta.hpp are almost identical; the difference is that the .hpp keeps everything in the ArduinoJson namespace.

Try online