Description

Adds a new nested array to the end of the array.

Signature

JsonArray createNestedArray();

Return value

A reference to the new JsonArray. You can check JsonArray::isNull() to verify that the allocation succeeded.

Example

StaticJsonDocument<200> doc;
JsonArray array = doc.to<JsonArray>();
array.add("hello");
JsonArray nested = array.createNestedArray();
nested.add("world");
serializeJson(array, Serial);

will write

["hello",["world"]]

See also