mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 00:32:37 +01:00 
			
		
		
		
	Reduced the size of the pretty JSON serializer
This commit is contained in:
		| @@ -39,13 +39,13 @@ void setup() { | ||||
|   data.add(48.756080); | ||||
|   data.add(2.302038); | ||||
|  | ||||
|   serializeJson(root, Serial); | ||||
|   serializeJson(doc, Serial); | ||||
|   // This prints: | ||||
|   // {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]} | ||||
|  | ||||
|   Serial.println(); | ||||
|  | ||||
|   serializeJsonPretty(root, Serial); | ||||
|   serializeJsonPretty(doc, Serial); | ||||
|   // This prints: | ||||
|   // { | ||||
|   //   "sensor": "gps", | ||||
|   | ||||
| @@ -79,7 +79,7 @@ void loop() { | ||||
|   } | ||||
|  | ||||
|   Serial.print(F("Sending: ")); | ||||
|   serializeJson(root, Serial); | ||||
|   serializeJson(doc, Serial); | ||||
|   Serial.println(); | ||||
|  | ||||
|   // Write response headers | ||||
| @@ -89,7 +89,7 @@ void loop() { | ||||
|   client.println(); | ||||
|  | ||||
|   // Write JSON document | ||||
|   serializeJsonPretty(root, client); | ||||
|   serializeJsonPretty(doc, client); | ||||
|  | ||||
|   // Disconnect | ||||
|   client.stop(); | ||||
|   | ||||
| @@ -75,11 +75,11 @@ void loop() { | ||||
|   Serial.print(remoteIp); | ||||
|   Serial.print(F(" on port ")); | ||||
|   Serial.println(remotePort); | ||||
|   serializeJson(root, Serial); | ||||
|   serializeJson(doc, Serial); | ||||
|  | ||||
|   // Send UDP packet | ||||
|   udp.beginPacket(remoteIp, remotePort); | ||||
|   serializeJson(root, udp); | ||||
|   serializeJson(doc, udp); | ||||
|   udp.println(); | ||||
|   udp.endPacket(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user