Updated API Reference (markdown)

Benoît Blanchon
2017-01-05 21:46:09 +01:00
parent fbfa61eadf
commit c17301bcb5

@ -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()