Skip to main content
Deletes a value at the specified path in a JSON document. If no path is specified, deletes the entire key.

Usage

Arguments

key
string
required
The key containing the JSON document
path
string
JSONPath expression specifying which parts to delete. If omitted, deletes the entire key.

Response

result
number
The number of paths deleted. Returns 0 if the key or path doesn’t exist.

Examples

Delete entire JSON document

Delete specific field

Delete nested field

Delete array element

Delete multiple paths

Check if deletion was successful

JSONPath Syntax

  • $ - Root element (deletes entire document)
  • $.field - Delete a specific field
  • $.field[0] - Delete array element at index
  • $.nested.field - Delete nested field
  • $..field - Delete all matching fields recursively
  • $.array[*] - Delete all array elements

See Also