Gets or creates the JsonVariant at the specified key.

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


JsonVariant set(const char* key) const;
JsonVariant set(String key) const;
JsonVariant set(std::string key) const;
JsonVariant set(const __FlashStringHelper* key) const;


key: the key of the value in the object.

Return value

If the key is already present in the object, this function returns the matching JsonVariant.

If the key is not present in the object, this function adds a new JsonVariant to the object and return it.

See also