mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Simplified generator example
This commit is contained in:
		| @@ -11,14 +11,13 @@ void setup() { | ||||
|  | ||||
|   StaticJsonBuffer<200> jsonBuffer; | ||||
|  | ||||
|   JsonArray& array = jsonBuffer.createArray(); | ||||
|   array.add(48.756080, 6);  // 6 is the number of decimals to print | ||||
|   array.add(2.302038, 6);   // if not specified, 2 digits are printed | ||||
|  | ||||
|   JsonObject& root = jsonBuffer.createObject(); | ||||
|   root["sensor"] = "gps"; | ||||
|   root["time"] = 1351824120; | ||||
|   root["data"] = array; | ||||
|  | ||||
|   JsonArray& data = root.createNestedArray("data"); | ||||
|   data.add(48.756080, 6);  // 6 is the number of decimals to print | ||||
|   data.add(2.302038, 6);   // if not specified, 2 digits are printed | ||||
|  | ||||
|   root.printTo(Serial); | ||||
|   // This prints: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user