removeItem

To remove a key-value pair from a given JSON object

This function allows you to remove key-value pairs from an already existing JSON object.

If your JSON object is stored in a variable, it will be modified even if the return value is not stored in the variable again.

Syntax

removeItem(JSON, string)

Return

JSON

Examples

removeItem(object, key) Removes a given key-value pair from a given JSON object.

let data := {
    lastName: "Rogers",
    firstName: "Brian"
};
removeItem(data, "firstName")

Result: The data object is changed: The key-value pair with the firstName key is deleted.

See also

setItem, which updates or adds a key-value pair in a given JSON object.

Last updated