DynamicJsonBuffer::clear() not resetting allocation size (issue #561)PGM_P as Particle 0.6.2 doesn't define it (issue #546)ARDUINOJSON_DOUBLE_IS_64BITS as it became useless.JsonBuffer non-copyable (PR #524 by @luisrayas3)StaticJsonBuffer::clear()DynamicJsonBuffer::clear()ARDUINOJSON_DOUBLE_IS_64BITSARDUINOJSON_EMBEDDED_MODE1e7 and 1e-5 (issues #288, #427 and #506)JsonVariant::is<double>() now returns true for integersIsBaseOf is not a member of ArduinoJson::TypeTraits (issue #495)forming reference to reference (issue #495)| Old syntax | New syntax |
|---|---|
double_with_n_digits(3.14, 2) |
3.14 |
float_with_n_digits(3.14, 2) |
3.14f |
obj.set("key", 3.14, 2) |
obj["key"] = 3.14 |
arr.add(3.14, 2) |
arr.add(3.14) |
| Input | Old output | New output |
|---|---|---|
3.14159 |
3.14 |
3.14159 |
42.0 |
42.00 |
42 |
0.0 |
0.00 |
0 |
| Expression | Old result | New result |
|---|---|---|
JsonVariant(42).is<int>() |
true |
true |
JsonVariant(42).is<float>() |
false |
true |
JsonVariant(42).is<double>() |
false |
true |
JsonArray::remove(iterator) (issue #479)JsonObject::remove(iterator)JsonArray::removeAt(size_t) into remove(size_t)include/ to src/floating constant exceeds range of floatand floating constant truncated to zero (issue #483)Print class and converted printTo() to a template method (issue #276)IndentedPrintExample.inostrtod() (issue #453)strtol() (issue #465)char is now treated as an integral type (issue #337, #370)DynamicJsonBuffer when memory allocation fails (issue #433)== and != for two JsonVariants (issue #436)JsonVariant::operator[const FlashStringHelper*] (issue #441)Stream timeout (issue #422)JsonObject is a char[] (issue #423)const referencesunsigned char* (issue #428)deprecated attribute on asArray(), asObject() and asString() (issue #420)volatile int to a JsonVariant (issue #415)ARDUINOJSON_ENABLE_STD_STREAM and ARDUINOJSON_ENABLE_ARDUINO_STREAM are set to 1== to compare JsonVariant and strings (issue #402)Stream (issue #300)JsonBuffer::parseObject() and JsonBuffer::parseArray() have been pulled down to the derived classes DynamicJsonBuffer and StaticJsonBufferBase.
This means that if you have code like:
void myFunction(JsonBuffer& jsonBuffer);
you need to replace it with one of the following:
void myFunction(DynamicJsonBuffer& jsonBuffer);
void myFunction(StaticJsonBufferBase& jsonBuffer);
template<typename TJsonBuffer> void myFunction(TJsonBuffer& jsonBuffer);
printTo(char[N]) and prettyPrintTo(char[N]) (issue #292)root["A"]["B"] = "C" (issue #352)*.ipp to *Impl.hpp because they were ignored by Arduino IDE (issue #396)int (issue #381)String or std::stringArduinoJson::StringJsonVariant::defaultValue<T>()JsonObject::get() and JsonArray.get()StringSumHelper (issue #184)ARDUINOJSON_USE_ARDUINO_STRING by ARDUINOJSON_ENABLE_STD_STRING and ARDUINOJSON_ENABLE_ARDUINO_STRING (issue #378)StringExample.ino to show where String can be usedThe non-template functions JsonObject::get() and JsonArray.get() have been removed. This means that you need to explicitely tell the type you expect in return.
Old code:
#define ARDUINOJSON_USE_ARDUINO_STRING 0
JsonVariant value1 = myObject.get("myKey");
JsonVariant value2 = myArray.get(0);
New code:
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
#define ARDUINOJSON_ENABLE_STD_STRING 1
JsonVariant value1 = myObject.get<JsonVariant>("myKey");
JsonVariant value2 = myArray.get<JsonVariant>(0);
array[idx].as<JsonVariant>() and object[key].as<JsonVariant>()JsonObject::set() (issue #350)Prettyfier and Print (issue #354)+ (issue #349)-Wparentheses warning introduced in v5.6.5 (PR #335 by @nuket).mbedignore for ARM mbdeb (PR #334 by @nuket)JsonVariant::success() which didn't propagate JsonArray::success() nor JsonObject::success() (issue #342).as<char*>() now returns true when input is null (issue #330)as<JsonArray>() as a synonym for as<JsonArray&>()... (issue #291)call of overloaded isinf(double&) is ambiguous (issue #284)#undef isnan (issue #284)#pragma once (issue #310)JsonVariant::success() (issue #279)JsonVariant::invalid<T>() to JsonVariant::defaultValue<T>()::String to ArduinoJson::String (issue #275)::Print to ArduinoJson::Print tooftoa (issues #266, #267, #269 and #270)JsonVariant JsonBuffer::parse() (issue #265)unsigned long printed as signed long (issue #170)JsonVariant::as<char*>() as a synonym for JsonVariant::as<const char*>() (issue #257)JsonHttpClient (issue #256)JsonArray::copyTo() and JsonArray::copyFrom() (issue #254)RawJson() to insert pregenerated JSON portions (issue #259)String duplication when one replaces a value in a JsonObject (PR #232 by @ulion)long long (issue #171)ArduinoJson/Configuration.hppBREAKING CHANGE:
If you defined ARDUINOJSON_ENABLE_STD_STREAM, you now need to define it to 1.
JsonVariant::is<bool>() that was incorrectly returning false (issue #214)add_subdirectory(ArduinoJson/src)String to be a typedef of std::string (issues #142 and #161)JsonVariant(true).as<String>() now returns "true" instead of "1"JsonVariant(false).as<String>() now returns "false" instead of "0"DynamicJsonBuffer constructor to set initial size (issue #152)JsonObjectSuscript::set(value, decimals) (issue #143)float instead of double to reduce the size of JsonVariant (issue #134)JsonArraySubscript and JsonObjectSubscript (issue #122)printTo(String) which wrote numbers instead of strings (issue #120)JsonArray::is<T>() and some others (issue #121)parseObject(String) and parseArray(String), when the
StaticJsonBuffer is too small to hold a copy of the stringString class (issues #55, #56, #70, #77)JsonBuffer::strdup() to make a copy of a string (issues #10, #57)strdup() for String but not for char* (issues #84, #87)JsonVariant to leverage converting constructors instead of assignment operators (issue #66)JsonObject::add() was renamed to set()JsonArray::at() and JsonObject::at() were renamed to get()double_with_n_digits()Personal note about the String class:
Support of the String class has been added to the library because many people use it in their programs.
However, you should not see this as an invitation to use the String class.
The String class is bad because it uses dynamic memory allocation.
Compared to static allocation, it compiles to a bigger, slower program, and is less predictable.
You certainly don't want that in an embedded environment!
DynamicJsonBuffer when memory allocation fails (issue #92)Upgrading is recommended since previous versions contain a potential security risk.
Special thanks to Giancarlo Canales Barreto for finding this nasty bug.
JsonArray::measureLength() and JsonObject::measureLength() (issue #75)JsonArray::removeAt() to remove an element of an array (issue #58)DynamicJsonBuffer when parsing huge JSON files (issue #65)parseArray() and parseObject() when allocation fails (issue #68)BREAKING CHANGE: API changed significantly, see Migrating code to the new API.
IndentedPrint, a decorator for Print to allow indented outputExample:
JsonOject<2> json;
json["key"] = "value";
json.prettyPrintTo(Serial);
JsonArray (bug introduced in v3.1).Generator::JsonObject::add() twice with the same key now replaces the valueGenerator::JsonObject::operator[], see bellow the new APIGenerator::JsonObject::remove() (issue #9)Old generator API:
JsonObject<3> root;
root.add("sensor", "gps");
root.add("time", 1351824120);
root.add("data", array);
New generator API:
JsonObject<3> root;
root["sensor"] = "gps";
root["time"] = 1351824120;
root["data"] = array;
JsonHashTable into JsonObjectJsonArray and JsonObject (issue #4)Old parser API:
JsonHashTable root = parser.parseHashTable(json);
char* sensor = root.getString("sensor");
long time = root.getLong("time");
double latitude = root.getArray("data").getDouble(0);
double longitude = root.getArray("data").getDouble(1);
New parser API:
JsonObject root = parser.parse(json);
char* sensor = root["sensor"];
long time = root["time"];
double latitude = root["data"][0];
double longitude = root["data"][1];
#include "jsmn.cpp" which caused an error in Linux (issue #6)ArduinoJsonParser becomes ArduinoJsonBreaking change: you need to add the following line at the top of your program.
using namespace ArduinoJson::Parser;
char* json into char[] json so that the bytes are not write protectedInitial release