mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 18:57:32 +02:00
Updated API Reference (markdown)
@ -13,6 +13,8 @@ Some parts have been simplified to be easier to understand, so if you look at th
|
||||
- [JsonArray](#jsonarray)
|
||||
- [Constructor](#constructor)
|
||||
- [JsonArray::add\(\)](#jsonarrayadd)
|
||||
- [JsonArray::copyFrom\(\)](#jsonarraycopyfrom)
|
||||
- [JsonArray::copyTo\(\)](#jsonarraycopyto)
|
||||
- [JsonArray::createNestedArray\(\)](#jsonarraycreatenestedarray)
|
||||
- [JsonArray::createNestedObject\(\)](#jsonarraycreatenestedobject)
|
||||
- [JsonArray::get\(\)](#jsonarrayget)
|
||||
@ -182,6 +184,73 @@ will write
|
||||
["hello",3.1416]
|
||||
```
|
||||
|
||||
### JsonArray::copyFrom()
|
||||
|
||||
##### Description
|
||||
|
||||
Populates the `JsonArray` with values from a C array.
|
||||
|
||||
##### Signatures
|
||||
|
||||
```c++
|
||||
JsonArray::copyFrom(int array[]);
|
||||
JsonArray::copyFrom(double array[]);
|
||||
JsonArray::copyFrom(const char* array[]);
|
||||
```
|
||||
|
||||
##### Return value
|
||||
|
||||
`true` if the operation is successful; or `false` if there was not enough room in the `JsonBuffer`.
|
||||
|
||||
##### Example
|
||||
|
||||
```c++
|
||||
int values[] = {1, 2, 3};
|
||||
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
JsonArray& array = jsonBuffer.createArray();
|
||||
array.copyFrom(values);
|
||||
array.printTo(Serial);
|
||||
```
|
||||
|
||||
will write
|
||||
|
||||
```json
|
||||
[1,2,3]
|
||||
```
|
||||
|
||||
|
||||
### JsonArray::copyTo()
|
||||
|
||||
##### Description
|
||||
|
||||
Extracts a C array from the `JsonArray`.
|
||||
|
||||
##### Signatures
|
||||
|
||||
```c++
|
||||
JsonArray::copyTo(int array[]);
|
||||
JsonArray::copyTo(double array[]);
|
||||
JsonArray::copyTo(const char* array[]);
|
||||
```
|
||||
|
||||
##### Return value
|
||||
|
||||
A `size_t` containing the number of values written in the array.
|
||||
|
||||
##### Example
|
||||
|
||||
```c++
|
||||
int values[3];
|
||||
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
JsonArray& array = jsonBuffer.parseArray("[1,2,3]");
|
||||
array.copyTo(values);
|
||||
```
|
||||
|
||||
now `values` contais `1`, `2` and `3`.
|
||||
|
||||
|
||||
|
||||
### JsonArray::createNestedArray()
|
||||
|
||||
|
Reference in New Issue
Block a user