Description

Depending on the type of the argument, JsonVariant::get() gets the value at the specified index, or it gets the value associated with the specified key. In other words, JsonVariant::get() reproduces JsonArray::get() and JsonObject::get().

Instead of this function, you can use JsonVariant::operator[] which offers a more intuitive syntax.

Despite what the name suggests, JsonVariant::get() is not the reverse operator of JsonVariant::set().

Signatures

// similar to JsonArray::get()
JsonVariant get(size_t index) const;

// similar to JsonObject::get()
JsonVariant get(const char* key) const;
JsonVariant get(String key) const;
JsonVariant get(std::string key) const;
JsonVariant get(const __FlashStringHelper* key) const;

Arguments

index: the index of the value in the array.

key: the key of the value in the object.

Return value

JsonVariant::get() returns a JsonVariant that points to the requested value.

JsonVariant::get() return null when no match is found.

See also