ArduinoJson 6.3.0-beta * Implemented reference semantics for `JsonVariant` * Replace `JsonPair`'s `key` and `value` with `key()` and `value()` * Fixed `serializeJson(obj[key], dst)` (issue #794)
⚠ ️
Special note ArduinoJson 6 requires updating code written for version 5. See the migration guide for details.
6.2.3-beta
Changes since- Implemented reference semantics for
JsonVariant
- Replace
JsonPair
'skey
andvalue
withkey()
andvalue()
- Fixed
serializeJson(obj[key], dst)
(issue #794)
⚠ ️
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:
- Use the Arduino Library Manager
- Download
ArduinoJson-v6.3.0-beta.h
put it in your project folder - Download
ArduinoJson-v6.3.0-beta.zip
and extract it in youlibraries
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.