JsonArray::copyFrom()
Description
Populates the JsonArray with values from a C array.
Signatures
// 1D arrays
JsonArray::copyFrom(T array[len]);
JsonArray::copyFrom(T* array, size_t len);
// 2D arrays
JsonArray::copyFrom(T array[][]);
Arguments
array: an array of value of type T.
len: the number of elements in the array.
T: the type of the value, can be any type supported by ArduinoJson.
Return value
true if the operation is successful; or false if there was not enough room in the JsonBuffer.
Example
int values[] = {1, 2, 3};
StaticJsonBuffer<200> jsonBuffer;
JsonArray& array = jsonBuffer.createArray();
array.copyFrom(values);
array.printTo(Serial);
will write
[1,2,3]