JsonArray::createNestedObject()
Description
JsonArray::createNestedObject() appends a new object to the array pointed by the JsonArray.
If the JsonArray is null/unbound, this function does nothing.
Signature
JsonObject createNestedObject() const;
Return value
JsonArray::createNestedObject() returns a JsonObject that points to the newly created object.
JsonArray::createNestedObject() returns null if the memory allocation fails; in which case JsonObject::isNull(), returns true.
Example
StaticJsonDocument<200> doc;
JsonArray array = doc.to<JsonArray>();
JsonObject nested = array.createNestedObject();
nested["hello"] = "world";
serializeJson(array, Serial);
will write
[{"hello":"world"}]