Description

JsonObjectConst::containsKey() tests whether a key exists in the object pointed by the JsonObjectConst.

If the JsonObjectConst is null, this function returns false.

Signature

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

Arguments

key: the key to look for.

Return value

JsonObjectConst::containsKey() returns a bool that tells whether the key was found or not:

  • true if the key is present in the object
  • false if the key is absent of the object

See also