mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Added JsonError
This commit is contained in:
		| @@ -35,9 +35,9 @@ void loadConfiguration(const char *filename, Config &config) { | ||||
|   StaticJsonObject<512> root; | ||||
|  | ||||
|   // Parse the root object | ||||
|   bool success = deserializeJson(root, file); | ||||
|   JsonError error = deserializeJson(root, file); | ||||
|  | ||||
|   if (!success) | ||||
|   if (error) | ||||
|     Serial.println(F("Failed to read file, using default configuration")); | ||||
|  | ||||
|   // Copy values from the JsonObject to the Config | ||||
|   | ||||
| @@ -76,8 +76,8 @@ void setup() { | ||||
|   DynamicJsonObject root(capacity); | ||||
|  | ||||
|   // Parse JSON object | ||||
|   bool success = deserializeJson(root, client); | ||||
|   if (!root.success()) { | ||||
|   JsonError error = deserializeJson(root, client); | ||||
|   if (error) { | ||||
|     Serial.println(F("Parsing failed!")); | ||||
|     return; | ||||
|   } | ||||
|   | ||||
| @@ -36,10 +36,10 @@ void setup() { | ||||
|   // It's a reference to the JsonObject, the actual bytes are inside the | ||||
|   // JsonBuffer with all the other nodes of the object tree. | ||||
|   // Memory is freed when jsonBuffer goes out of scope. | ||||
|   bool success = deserializeJson(root, json); | ||||
|   JsonError error = deserializeJson(root, json); | ||||
|  | ||||
|   // Test if parsing succeeds. | ||||
|   if (!success) { | ||||
|   if (error) { | ||||
|     Serial.println("parseObject() failed"); | ||||
|     return; | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user