JsonArray::createNestedObject()
Description
Adds a new nested object to the end of the array.
Signature
JsonObject& createNestedObject();
Return value
A reference to the new JsonObject
.
You can check JsonObject::success()
to verify that the allocation succeeded.
Example
StaticJsonBuffer<200> jsonBuffer;
JsonArray& array = jsonBuffer.createArray();
JsonObject& nested = array.createNestedObject();
nested["hello"] = "world";
array.printTo(Serial);
will write
[{"hello":"world"}]