content/commands/json.debug-memory.md
Report a value's memory usage in bytes
{{< warning >}} The actual total memory consumption by a key could be much lower than the value reported by this command because of an internal JSON string reuse mechanism. For more information, see the [JSON memory usage page]({{< relref "/develop/data-types/json/ram#json-string-reuse-mechanism" >}}). {{< /warning >}}
is key to parse.
</details>is JSONPath to specify. Default is root $.
Create a JSON document.
{{< highlight bash >}} redis> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}' OK {{< / highlight >}}
Get the values' memory usage in bytes.
{{< highlight bash >}} redis> JSON.DEBUG MEMORY item:2 (integer) 573 {{< / highlight >}}
</details>| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Supported</span> | <span title="Supported">✅ Flexible & Annual</span> <span title="Supported">✅ Free & Fixed</nobr></span> | |
{{< multitabs id="json-debug-memory-return-info" tab1="RESP2" tab2="RESP3" >}}
[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the value size in bytes.
-tab-sep-
[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the value size in bytes.
{{< /multitabs >}}
[JSON.SET]({{< relref "commands/json.set/" >}}) | [JSON.ARRLEN]({{< relref "commands/json.arrlen/" >}})