mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Don't use JsonBuffer to create or parse objects and arrays.
* Added DynamicJsonArray and StaticJsonArray * Added DynamicJsonObject and StaticJsonObject * Added DynamicJsonVariant and StaticJsonVariant * Added deserializeJson() * Removed JsonBuffer::parseArray(), parseObject() and parse() * Removed JsonBuffer::createArray() and createObject()
This commit is contained in:
		| @@ -11,24 +11,17 @@ void setup() { | ||||
|   Serial.begin(9600); | ||||
|   while (!Serial) continue; | ||||
|  | ||||
|   // Memory pool for JSON object tree. | ||||
|   // Root JSON object | ||||
|   // | ||||
|   // Inside the brackets, 200 is the size of the pool in bytes. | ||||
|   // Inside the brackets, 200 is the size of the memory pool in bytes. | ||||
|   // Don't forget to change this value to match your JSON document. | ||||
|   // Use arduinojson.org/assistant to compute the capacity. | ||||
|   StaticJsonBuffer<200> jsonBuffer; | ||||
|   StaticJsonObject<200> root; | ||||
|  | ||||
|   // StaticJsonBuffer allocates memory on the stack, it can be | ||||
|   // replaced by DynamicJsonBuffer which allocates in the heap. | ||||
|   // StaticJsonObject allocates memory on the stack, it can be | ||||
|   // replaced by DynamicJsonObject which allocates in the heap. | ||||
|   // | ||||
|   // DynamicJsonBuffer  jsonBuffer(200); | ||||
|  | ||||
|   // Create the root of the object tree. | ||||
|   // | ||||
|   // 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. | ||||
|   JsonObject& root = jsonBuffer.createObject(); | ||||
|   // DynamicJsonObject  root(200); | ||||
|  | ||||
|   // Add values in the object | ||||
|   // | ||||
| @@ -78,4 +71,4 @@ void loop() { | ||||
| // The book "Mastering ArduinoJson" contains a tutorial on serialization. | ||||
| // It begins with a simple example, like the one above, and then adds more | ||||
| // features like serializing directly to a file or an HTTP request. | ||||
| // Please check it out at: https://arduinojson.org/book/ | ||||
| // Please check it out at: https://arduinojson.org/book/ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user