ArduinoJson: API Reference

JsonObject::remove()

Description

Removes the element at the specified key.

IMPORTANT: This function doesn’t free the memory allocated to the element in the JsonBuffer. This behavior has been prefered to keep the JsonBuffer fast and small, which is a foundational principle of the library.

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

key: the key to remove from the object.

Example
JsonObject& object = jsonBuffer.createObject();
object["A"] = 1;
object["B"] = 2;
object["C"] = 3;
object.remove("B");
object.printTo(Serial);

will print the following string to the serial output:

{"A":1,"C":3}
Fork me on GitHub