Description

Removes the element at the specified key.

Signatures

void remove(const char* key) const;
void remove(const String& key) const;
void remove(const std::string& key) const;
void remove(const __FlashStringHelper* key) const;

Arguments

key: the key to remove from the object.

Example

JsonObject object = doc.to<JsonObject>();
object["A"] = 1;
object["B"] = 2;
object["C"] = 3;
object.remove("B");
serializeJson(object, Serial);

will print the following string to the serial output:

{"A":1,"C":3}

See also