forked from bblanchon/ArduinoJson
Fixed deserializeJson()
that stopped reading after {}
(fixes #1335)
This commit is contained in:
@ -1,6 +1,11 @@
|
|||||||
ArduinoJson: change log
|
ArduinoJson: change log
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
----
|
||||||
|
|
||||||
|
* Fixed `deserializeJson()` that stopped reading after `{}` (issue #1335)
|
||||||
|
|
||||||
v6.16.0 (2020-08-01)
|
v6.16.0 (2020-08-01)
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -290,4 +290,10 @@ TEST_CASE("deserialize JSON object") {
|
|||||||
REQUIRE(obj.size() == 0);
|
REQUIRE(obj.size() == 0);
|
||||||
REQUIRE(doc.memoryUsage() == JSON_OBJECT_SIZE(0));
|
REQUIRE(doc.memoryUsage() == JSON_OBJECT_SIZE(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Issue #1335") {
|
||||||
|
std::string json("{\"a\":{},\"b\":{}}");
|
||||||
|
deserializeJson(doc, json);
|
||||||
|
CHECK(doc.as<std::string>() == json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,8 @@ class JsonDeserializer {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Empty object?
|
// Empty object?
|
||||||
if (eat('}')) {
|
if (eat('}'))
|
||||||
_error = DeserializationError::Ok;
|
return true;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read each key value pair
|
// Read each key value pair
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
Reference in New Issue
Block a user