JsonVariantConst::getMember() gets the value associated with the specified key; it reproduces JsonObject::getMember().

If the JsonVariantConst points to an object, this function returns a JsonVariantConst pointing to the specified member.

If the JsonVariantConst does not point to an object, this function returns a null JsonVariantConst.

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


JsonVariantConst getMember(const char* key) const;
JsonVariantConst getMember(const String& key) const;
JsonVariantConst getMember(const std::string& key) const;
JsonVariantConst getMember(std::string_view key) const;  // 🆕 (added in 6.18.1)
JsonVariantConst getMember(const __FlashStringHelper* key) const;


key: the key of the value in the object.

Return value

JsonVariantConst::getMember() returns a JsonVariantConst that points to the requested value.

JsonVariantConst::getMember() return null when no match is found.

See also