Description

Extracts a C array from the JsonArray.

Signatures

JsonArray::copyTo(int array[]) const;
JsonArray::copyTo(double array[]) const;
JsonArray::copyTo(const char* array[]) const;

Return value

A size_t containing the number of values written in the array.

Example

int values[3];

StaticJsonDocument<200> doc;
deserializeJson(doc, "[1,2,3]");
JsonArray array = doc.as<JsonArray>();
array.copyTo(values);

now values contais 1, 2 and 3.

See also