Fixed deserializeJson() that stopped reading after {} (fixes #1335)

This commit is contained in:
Benoit Blanchon
2020-08-04 09:52:42 +02:00
parent 96b6571352
commit 35a39b8d8f
3 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,11 @@
ArduinoJson: change log
=======================
HEAD
----
* Fixed `deserializeJson()` that stopped reading after `{}` (issue #1335)
v6.16.0 (2020-08-01)
-------

View File

@ -290,4 +290,10 @@ TEST_CASE("deserialize JSON object") {
REQUIRE(obj.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);
}
}

View File

@ -213,10 +213,8 @@ class JsonDeserializer {
return false;
// Empty object?
if (eat('}')) {
_error = DeserializationError::Ok;
return false;
}
if (eat('}'))
return true;
// Read each key value pair
for (;;) {