ArduinoJson: API Reference

JsonArray::copyFrom()

Description

Populates the JsonArray with values from a C array.

Signatures
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
int values[] = {1, 2, 3};

StaticJsonBuffer<200> jsonBuffer;
JsonArray& array = jsonBuffer.createArray();
array.copyFrom(values);
array.printTo(Serial);

will write

[1,2,3]
Fork me on GitHub