{
  "schema_version": 2,
  "id": "commands/json.debug-memory",
  "title": "JSON.DEBUG MEMORY",
  "url": "https://redis.io/docs/latest/commands/json.debug-memory/",
  "summary": "Reports the size in bytes of a key",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:47:58+01:00",
  "page_type": "content",
  "content_hash": "2adb76a00a9273bbcd49853d7c75510d8411c7ed268708de1ec326e7b0846442",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Report a value's memory usage in bytes \n\n> [!WARNING]\n> 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](https://redis.io/docs/latest/develop/data-types/json/ram#json-string-reuse-mechanism).\n\n[Examples](#examples)"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary> \n\nis key to parse.\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>path</code></summary> \n\nis JSONPath to specify. Default is root `$`. \n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "<details open>\n<summary><b>Report a value's memory usage in bytes</b></summary>\n\nCreate a JSON document.\n\n\nredis> 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]}'\nOK\n\n\nGet the values' memory usage in bytes.\n\n\nredis> JSON.DEBUG MEMORY item:2\n(integer) 573\n\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span><br /> | <span title=\"Supported\">&#x2705; Flexible & Annual</span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the value size in bytes.\n\n**RESP3:**\n\n[Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the value size in bytes."
    },
    {
      "id": "see-also",
      "title": "See also",
      "role": "related",
      "text": "[`JSON.SET`](https://redis.io/docs/latest/commands/json.set) | [`JSON.ARRLEN`](https://redis.io/docs/latest/commands/json.arrlen)"
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "* [RedisJSON](https://redis.io/docs/latest/develop/data-types/json)\n* [Index and search JSON documents](https://redis.io/docs/latest/develop/ai/search-and-query/indexing)"
    }
  ],
  "examples": []
}
