mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-09-26 15:00:57 +02:00
Updated API Reference (markdown)
@@ -87,11 +87,79 @@ array.printTo(Serial);
|
|||||||
|
|
||||||
will write
|
will write
|
||||||
|
|
||||||
```
|
```json
|
||||||
["hello",3.1416]
|
["hello",3.1416]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### JsonArray::createNestedArray()
|
||||||
|
|
||||||
|
##### Description
|
||||||
|
|
||||||
|
Adds a new nested array to the end of the array.
|
||||||
|
|
||||||
|
##### Signature
|
||||||
|
|
||||||
|
```c++
|
||||||
|
JsonArray& createNestedArray();
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Return value
|
||||||
|
|
||||||
|
A reference to the new `JsonArray`.
|
||||||
|
You can check `JsonArray::success()` to verify that the allocation succeeded.
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
```c++
|
||||||
|
StaticJsonBuffer<200> jsonBuffer;
|
||||||
|
JsonArray& array = jsonBuffer.createArray();
|
||||||
|
array.add("hello");
|
||||||
|
JsonArray& nested = array.createNestedArray();
|
||||||
|
nested.add("world");
|
||||||
|
array.printTo(Serial);
|
||||||
|
```
|
||||||
|
|
||||||
|
will write
|
||||||
|
|
||||||
|
```json
|
||||||
|
["hello",["world"]]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### JsonArray::createNestedObject()
|
||||||
|
|
||||||
|
##### Description
|
||||||
|
|
||||||
|
Adds a new nested object to the end of the array.
|
||||||
|
|
||||||
|
##### Signature
|
||||||
|
|
||||||
|
```c++
|
||||||
|
JsonObject& createNestedObject();
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Return value
|
||||||
|
|
||||||
|
A reference to the new `JsonObject`.
|
||||||
|
You can check `JsonObject::success()` to verify that the allocation succeeded.
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
```c++
|
||||||
|
StaticJsonBuffer<200> jsonBuffer;
|
||||||
|
JsonArray& array = jsonBuffer.createArray();
|
||||||
|
JsonObject& nested = array.createNestedObject();
|
||||||
|
nested["hello"] = "world";
|
||||||
|
array.printTo(Serial);
|
||||||
|
```
|
||||||
|
|
||||||
|
will write
|
||||||
|
|
||||||
|
```json
|
||||||
|
[{"hello":"world"}]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### JsonArray::get()
|
### JsonArray::get()
|
||||||
|
|
||||||
@@ -693,7 +761,8 @@ To avoid this behavior, use a `const char*` key instead.
|
|||||||
|
|
||||||
##### Return value
|
##### Return value
|
||||||
|
|
||||||
A reference to the new `JsonArray`
|
A reference to the new `JsonArray`.
|
||||||
|
You can check `JsonArray::success()` to verify that the allocatio succeeded.
|
||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
@@ -744,7 +813,8 @@ To avoid this behavior, use a `const char*` key instead.
|
|||||||
|
|
||||||
##### Return value
|
##### Return value
|
||||||
|
|
||||||
A reference to the new `JsonObject`
|
A reference to the new `JsonObject`.
|
||||||
|
You can check `JsonObject::success()` to verify that the allocatio succeeded.
|
||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user