JsonVariant::createNestedObject()
Description
JsonVariant::createNestedObject()
adds a new object as a child of the JsonVariant
. This function reproduces JsonArray::createNestedObject()
or JsonObject::createNestedObject()
depending on the argument.
The call is ignored of the JsonVariant
is incompatible with the operation. For example, if you call JsonVariant::createNestedObject()
without argument on a JsonVariant
that contains an object, the function does nothing.
Signature
// similar to JsonArray::createNestedObject()
JsonObject createNestedObject() const;
// similar to JsonObject::createNestedObject()
JsonObject createNestedObject(const char* key) const;
JsonObject createNestedObject(char* key) const;
JsonObject createNestedObject(const String& key) const;
JsonObject createNestedObject(const std::string& key) const;
JsonObject createNestedObject(std::string_view key) const;
JsonObject createNestedObject(const __FlashStringHelper* key) const;
Return value
JsonArray::createNestedObject()
returns a reference to the new object.
You can check JsonObject::isNull()
to verify that the allocation succeeded.