mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	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