Skip to content

ArduinoJson 6.3.0-beta

Pre-release
Pre-release
Compare
Choose a tag to compare
@bblanchon bblanchon released this 31 Aug 15:34

Special note ⚠️

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

Changes since 6.2.3-beta

  • Implemented reference semantics for JsonVariant
  • Replace JsonPair's key and value with key() and value()
  • Fixed serializeJson(obj[key], dst) (issue #794)

View version history

BREAKING CHANGES ⚠️

JsonVariant

JsonVariant now has a semantic similar to JsonObject and JsonArray.
It's a reference to a value stored in the JsonDocument.
As a consequence, a JsonVariant cannot be used as a standalone variable anymore.

Old code:

JsonVariant myValue = 42;

New code:

DynamicJsonDocument doc;
JsonVariant myValue = doc.to<JsonVariant>();
myValue.set(42);

JsonPair

Old code:

for(JsonPair p : myObject) {
  Serial.println(p.key);
  Serial.println(p.value.as<int>());
}

New code:

for(JsonPair p : myObject) {
  Serial.println(p.key());
  Serial.println(p.value().as<int>());
}

CAUTION: the key is now read only!

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.3.0-beta.h put it in your project folder
  3. Download ArduinoJson-v6.3.0-beta.zip and extract it in you libraries folder

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

Try online