- Removed dependency on
PGM_P
as Particle 0.6.2 doesn't define it (issue #546) - Fixed warning "dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]"
- Fixed warning "floating constant exceeds range of 'float' [-Woverflow]" (issue #544)
- Removed
ARDUINOJSON_DOUBLE_IS_64BITS
as it became useless.
- Made
JsonBuffer
non-copyable (PR #524 by @luisrayas3) - Added
StaticJsonBuffer::clear()
- Added
DynamicJsonBuffer::clear()
- Fixed IntelliSense errors in Visual Micro (issue #483)
- Fixed compilation in IAR Embedded Workbench (issue #515)
- Fixed reading "true" as a float (issue #516)
- Added
ARDUINOJSON_DOUBLE_IS_64BITS
- Added
ARDUINOJSON_EMBEDDED_MODE
- Removed configurable number of decimal places (issues #288, #427 and #506)
- Changed exponentiation thresholds to
1e7
and1e-5
(issues #288, #427 and #506) JsonVariant::is<double>()
now returnstrue
for integers- Fixed error
IsBaseOf is not a member of ArduinoJson::TypeTraits
(issue #495) - Fixed error
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 |
- Added
JsonArray::remove(iterator)
(issue #479) - Added
JsonObject::remove(iterator)
- Renamed
JsonArray::removeAt(size_t)
intoremove(size_t)
- Renamed folder
include/
tosrc/
- Fixed warnings
floating constant exceeds range of float
andfloating constant truncated to zero
(issue #483) - Removed
Print
class and convertedprintTo()
to a template method (issue #276) - Removed example
IndentedPrintExample.ino
- Now compatible with Particle 0.6.1, thanks to Jacob Nite (issue #294 and PR #461 by @foodbag)
- Added custom implementation of
strtod()
(issue #453) - Added custom implementation of
strtol()
(issue #465) char
is now treated as an integral type (issue #337, #370)
- Fixed an access violation in
DynamicJsonBuffer
when memory allocation fails (issue #433) - Added operators
==
and!=
for twoJsonVariant
s (issue #436) - Fixed
JsonVariant::operator[const FlashStringHelper*]
(issue #441)
- Fixed parsing of comments (issue #421)
- Fixed ignored
Stream
timeout (issue #422) - Made sure we don't read more that necessary (issue #422)
- Fixed error when the key of a
JsonObject
is achar[]
(issue #423) - Reduced code size when using
const
references - Fixed error with string of type
unsigned char*
(issue #428) - Added
deprecated
attribute onasArray()
,asObject()
andasString()
(issue #420)
- Fixed error when assigning a
volatile int
to aJsonVariant
(issue #415) - Fixed errors with Variable Length Arrays (issue #416)
- Fixed error when both
ARDUINOJSON_ENABLE_STD_STREAM
andARDUINOJSON_ENABLE_ARDUINO_STREAM
are set to1
- Fixed error "Stream does not name a type" (issue #412)
- Added operator
==
to compareJsonVariant
and strings (issue #402) - Added support for
Stream
(issue #300) - Reduced memory consumption by not duplicating spaces and comments
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);
- Added an
printTo(char[N])
andprettyPrintTo(char[N])
(issue #292) - Added ability to set a nested value like this:
root["A"]["B"] = "C"
(issue #352) - Renamed
*.ipp
to*Impl.hpp
because they were ignored by Arduino IDE (issue #396)
- Made PROGMEM available on more platforms (issue #381)
- Fixed PROGMEM causing an exception on ESP8266 (issue #383)
- Added support for PROGMEM (issue #76)
- Fixed compilation error when index is not an
int
(issue #381)
- Templatized all functions using
String
orstd::string
- Removed
ArduinoJson::String
- Removed
JsonVariant::defaultValue<T>()
- Removed non-template
JsonObject::get()
andJsonArray.get()
- Fixed support for
StringSumHelper
(issue #184) - Replaced
ARDUINOJSON_USE_ARDUINO_STRING
byARDUINOJSON_ENABLE_STD_STRING
andARDUINOJSON_ENABLE_ARDUINO_STRING
(issue #378) - Added example
StringExample.ino
to show whereString
can be used - Increased default nesting limit to 50 when compiled for a computer (issue #349)
The 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);
- Fixed
array[idx].as<JsonVariant>()
andobject[key].as<JsonVariant>()
- Fixed return value of
JsonObject::set()
(issue #350) - Fixed undefined behavior in
Prettyfier
andPrint
(issue #354) - Fixed parser that incorrectly rejected floats containing a
+
(issue #349)
- Fixed
-Wparentheses
warning introduced in v5.6.5 (PR #335 by @nuket) - Added
.mbedignore
for ARM mbdeb (PR #334 by @nuket) - Fixed
JsonVariant::success()
which didn't propagateJsonArray::success()
norJsonObject::success()
(issue #342).
as<char*>()
now returnstrue
when input isnull
(issue #330)
- Fixed error in float serialization (issue #324)
- Improved speed of float serialization (about twice faster)
- Added
as<JsonArray>()
as a synonym foras<JsonArray&>()
... (issue #291) - Fixed
call of overloaded isinf(double&) is ambiguous
(issue #284)
- Fixed build when another lib does
#undef isnan
(issue #284)
- Added missing
#pragma once
(issue #310)
- ArduinoJson is now a header-only library (issue #199)
- Fixed compilation error with Intel Galileo (issue #299)
- Added
JsonVariant::success()
(issue #279) - Renamed
JsonVariant::invalid<T>()
toJsonVariant::defaultValue<T>()
- Changed
::String
toArduinoJson::String
(issue #275) - Changed
::Print
toArduinoJson::Print
too
- Added custom implementation of
ftoa
(issues #266, #267, #269 and #270) - Added
JsonVariant JsonBuffer::parse()
(issue #265) - Fixed
unsigned long
printed assigned long
(issue #170)
- Added
JsonVariant::as<char*>()
as a synonym forJsonVariant::as<const char*>()
(issue #257) - Added example
JsonHttpClient
(issue #256) - Added
JsonArray::copyTo()
andJsonArray::copyFrom()
(issue #254) - Added
RawJson()
to insert pregenerated JSON portions (issue #259)
- Removed
String
duplication when one replaces a value in aJsonObject
(PR #232 by @ulion)
- Added support of
long long
(issue #171) - Moved all build settings to
ArduinoJson/Configuration.hpp
BREAKING CHANGE:
If you defined ARDUINOJSON_ENABLE_STD_STREAM
, you now need to define it to 1
.
- Made the library compatible with PlatformIO (issue #181)
- Fixed
JsonVariant::is<bool>()
that was incorrectly returning false (issue #214)
- Made library easier to use from a CMake project: simply
add_subdirectory(ArduinoJson/src)
- Changed
String
to be atypedef
ofstd::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"
- Added parameter to
DynamicJsonBuffer
constructor to set initial size (issue #152) - Fixed warning about library category in Arduino 1.6.6 (issue #147)
- Examples: Added a loop to wait for serial port to be ready (issue #156)
- Added overload
JsonObjectSuscript::set(value, decimals)
(issue #143) - Use
float
instead ofdouble
to reduce the size ofJsonVariant
(issue #134)
- Fixed ambiguous overload with
JsonArraySubscript
andJsonObjectSubscript
(issue #122)
- Fixed
printTo(String)
which wrote numbers instead of strings (issue #120) - Fixed return type of
JsonArray::is<T>()
and some others (issue #121)
- Fixed segmentation fault in
parseObject(String)
andparseArray(String)
, when theStaticJsonBuffer
is too small to hold a copy of the string - Fixed Clang warning "register specifier is deprecated" (issue #102)
- Fixed GCC warning "declaration shadows a member" (issue #103)
- Fixed memory alignment, which made ESP8266 crash (issue #104)
- Fixed compilation on Visual Studio 2010 and 2012 (issue #107)
- Fixed compilation with Arduino 1.0.6 (issue #99)
- Added support of
String
class (issues #55, #56, #70, #77) - Added
JsonBuffer::strdup()
to make a copy of a string (issues #10, #57) - Implicitly call
strdup()
forString
but not forchar*
(issues #84, #87) - Added support of non standard JSON input (issue #44)
- Added support of comments in JSON input (issue #88)
- Added implicit cast between numerical types (issues #64, #69, #93)
- Added ability to read number values as string (issue #90)
- Redesigned
JsonVariant
to leverage converting constructors instead of assignment operators (issue #66) - Switched to new the library layout (requires Arduino 1.0.6 or above)
JsonObject::add()
was renamed toset()
JsonArray::at()
andJsonObject::at()
were renamed toget()
- Number of digits of floating point value are now set with
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!
- Fixed segmentation fault in
DynamicJsonBuffer
when memory allocation fails (issue #92)
- Fixed buffer overflow when input contains a backslash followed by a terminator (issue #81)
Upgrading is recommended since previous versions contain a potential security risk.
Special thanks to Giancarlo Canales Barreto for finding this nasty bug.
- Added
JsonArray::measureLength()
andJsonObject::measureLength()
(issue #75)
- Added
JsonArray::removeAt()
to remove an element of an array (issue #58) - Fixed stack-overflow in
DynamicJsonBuffer
when parsing huge JSON files (issue #65) - Fixed wrong return value of
parseArray()
andparseObject()
when allocation fails (issue #68)
- Switched back to old library layout (issues #39, #43 and #45)
- Removed global new operator overload (issue #40, #45 and #46)
- Added an example with EthernetServer
- Added DynamicJsonBuffer (issue #19)
- Unified parser and generator API (issue #23)
- Updated library layout, now requires Arduino 1.0.6 or newer
BREAKING CHANGE: API changed significantly, see Migrating code to the new API.
- Fixed escaped char parsing (issue #16)
- Added indented output for the JSON generator (issue #11), see example bellow.
- Added
IndentedPrint
, a decorator forPrint
to allow indented output
Example:
JsonOject<2> json;
json["key"] = "value";
json.prettyPrintTo(Serial);
- Fixed a bug when adding nested object in
JsonArray
(bug introduced in v3.1).
- Calling
Generator::JsonObject::add()
twice with the samekey
now replaces thevalue
- Added
Generator::JsonObject::operator[]
, see bellow the new API - Added
Generator::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;
- New parser API, see bellow
- Renamed
JsonHashTable
intoJsonObject
- Added iterators for
JsonArray
andJsonObject
(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];
- Fixed case
#include "jsmn.cpp"
which caused an error in Linux (issue #6) - Fixed a buffer overrun in JSON Parser (issue #5)
- Added JSON encoding (issue #2)
- Renamed the library
ArduinoJsonParser
becomesArduinoJson
Breaking change: you need to add the following line at the top of your program.
using namespace ArduinoJson::Parser;
- Fixed error in JSON parser example (issue #1)
- Example: changed
char* json
intochar[] json
so that the bytes are not write protected - Fixed parsing bug when the JSON contains multi-dimensional arrays
Initial release