Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

JSON.DEL

Focus mode
JSON.DEL - Amazon MemoryDB

Delete the JSON values at the path in a document key. If the path is the root, it is equivalent to deleting the key from Valkey or Redis OSS.

Syntax

JSON.DEL <key> [path]
  • key (required) – key of JSON document type

  • path (optional) – a JSON path. Defaults to the root if not provided

Return

  • Number of elements deleted.

  • 0 if the key does not exist.

  • 0 if the JSON path is invalid or does not exist.

Examples

Enhanced path syntax:

127.0.0.1:6379> JSON.SET k1 . '{"a":{}, "b":{"a":1}, "c":{"a":1, "b":2}, "d":{"a":1, "b":2, "c":3}, "e": [1,2,3,4,5]}' OK 127.0.0.1:6379> JSON.DEL k1 $.d.* (integer) 3 127.0.0.1:6379> JSOn.GET k1 "{\"a\":{},\"b\":{\"a\":1},\"c\":{\"a\":1,\"b\":2},\"d\":{},\"e\":[1,2,3,4,5]}" 127.0.0.1:6379> JSON.DEL k1 $.e[*] (integer) 5 127.0.0.1:6379> JSOn.GET k1 "{\"a\":{},\"b\":{\"a\":1},\"c\":{\"a\":1,\"b\":2},\"d\":{},\"e\":[]}"

Restricted path syntax:

127.0.0.1:6379> JSON.SET k1 . '{"a":{}, "b":{"a":1}, "c":{"a":1, "b":2}, "d":{"a":1, "b":2, "c":3}, "e": [1,2,3,4,5]}' OK 127.0.0.1:6379> JSON.DEL k1 .d.* (integer) 3 127.0.0.1:6379> JSON.GET k1 "{\"a\":{},\"b\":{\"a\":1},\"c\":{\"a\":1,\"b\":2},\"d\":{},\"e\":[1,2,3,4,5]}" 127.0.0.1:6379> JSON.DEL k1 .e[*] (integer) 5 127.0.0.1:6379> JSON.GET k1 "{\"a\":{},\"b\":{\"a\":1},\"c\":{\"a\":1,\"b\":2},\"d\":{},\"e\":[]}"
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.