Usage
Arguments
string
required
The key containing the JSON document
string
JSONPath expression specifying which parts to delete. If omitted, deletes the entire key.
Response
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
- JSON.GET - Get JSON values
- JSON.SET - Set JSON values
- Redis JSON.DEL documentation