Populates the JsonArray with values from a C array.


bool copyFrom(JsonArray array) const;

// 1D arrays
bool copyFrom(T array[len]) const;
bool copyFrom(T* array, size_t len) const;

// 2D arrays
bool copyFrom(T array[][]) const;


array: the array to copy, can be a JsonArray, or a C++ array.

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 JsonDocument.


int values[] = {1, 2, 3};

StaticJsonDocument<200> doc;
JsonArray array =<JsonArray>();
serializeJson(array, Serial);

will write


See also