mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-15 18:41:12 +02:00
Updated API Reference (markdown)
@@ -138,6 +138,53 @@ const char* value2 = array.get(2); // returns NULL
|
||||
##### Example
|
||||
```c++
|
||||
```
|
||||
|
||||
## JsonArray::printTo()
|
||||
|
||||
### Description
|
||||
|
||||
Serialize the array to a JSON string.
|
||||
|
||||
This will create a compact JSON, if you want a pretty JSON with spaces and line breaks, use `JsonArray::prettyPrint()`
|
||||
|
||||
### Signatures
|
||||
|
||||
```c++
|
||||
size_t printTo(char* buffer, size_t size) const;
|
||||
size_t printTo(Print &) const;
|
||||
size_t printTo(String &) const;
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
The destination of the JSON string.
|
||||
|
||||
Can be either:
|
||||
|
||||
* a `buffer` with specified `size`
|
||||
* an implementation of `Print` (like `Serial`, `EthernetClient`...)
|
||||
* a `String`
|
||||
|
||||
### Return value
|
||||
|
||||
The number of bytes written
|
||||
|
||||
### Example
|
||||
|
||||
```c++
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
JsonArray& array = jsonBuffer.createArray();
|
||||
array.add("hello");
|
||||
array.add("world");
|
||||
array.printTo(Serial);
|
||||
```
|
||||
|
||||
will write the following string to the serial output:
|
||||
|
||||
```json
|
||||
["hello","world"]
|
||||
```
|
||||
|
||||
#### JsonArray::removeAt()
|
||||
##### Description
|
||||
Removes element at specified index.
|
||||
|
Reference in New Issue
Block a user