{
  "schema_version": 2,
  "id": "commands/json.strappend",
  "title": "JSON.STRAPPEND",
  "url": "https://redis.io/docs/latest/commands/json.strappend/",
  "summary": "Appends a string to JSON strings at the paths matching a given path expression",
  "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": "f0866299b54a5dd6b6844a4a7beea22fd16cc8813ca10ce521a69e0903cedc20",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Appends a string to JSON strings at the paths matching a given path expression.\n\n[Examples](#examples)"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary> \n\nis a Redis key storing a value of type JSON.\n\n</details>\n\n<details open><summary><code>value</code></summary> \n\nis a string to append to the JSON strings at the paths matching `path`.\n\n> [!NOTE] About using strings with JSON commands\n> To specify a string as an array value to append, wrap the quoted string with an additional set of single quotes. Example: `'\"silver\"'`. For more detailed use, see [Examples](#examples).\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>path</code></summary> \n\nis either \n\n- A JSONPath expression\n  - The root \"`$`\", or any string that starts with \"`$.`\" or \"`$[`\".\n  - Resolves to all matching locations in `key`.\n- A legacy path expression \n  - Any string that does not match the JSONPath syntax above.\n  - Allow the leading \"`.`\" to be omitted (for example, \"`name`\" and \"`.name`\" are equivalent).\n  - Resolves to only the first matching location in `key`.\n \nDefault: \"`.`\" (legacy path pointing to the root of the document).\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> JSON.SET doc $ '{\"a\":\"foo\", \"nested\": {\"a\": \"hello\"}, \"nested2\": {\"a\": 31}}'\nOK\nredis> JSON.STRAPPEND doc $..a '\"baz\"'\n1) (integer) 6\n2) (integer) 8\n3) (nil)\nredis> JSON.GET doc $\n\"[{\\\"a\\\":\\\"foobaz\\\",\\\"nested\\\":{\\\"a\\\":\\\"hellobaz\\\"},\\\"nested2\\\":{\\\"a\\\":31}}]\""
    },
    {
      "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\nIf `path` is a JSONPath expression:\n\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `key` does not exist.\n- An empty [array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) if `path` has no matches.\n- An [array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) where each array element corresponds to one match:\n  - [`nil`](https://redis.io/docs/latest/develop/reference/protocol-spec#null-bulk-strings) if the match is not a string.\n  - An [integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the new length of the string.\n\nIf `path` is a legacy path expression:\n\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `key` does not exist.\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `path` has no matches.\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if the first match is not a string.\n- An [integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the new length of the string at the first match.\n\n**RESP3:**\n\nIf `path` is a JSONPath expression:\n\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `key` does not exist.\n- An empty [array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) if `path` has no matches.\n- An [array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) where each array element corresponds to one match:\n  - [`nil`](https://redis.io/docs/latest/develop/reference/protocol-spec#nulls) if the match is not a string.\n  - An [integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the new length of the string.\n\nIf `path` is a legacy path expression:\n\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `key` does not exist.\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if `path` has no matches.\n- A [simple error](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if the first match is not a string.\n- An [integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the new length of the string at the first match."
    },
    {
      "id": "see-also",
      "title": "See also",
      "role": "related",
      "text": "[`JSON.STRLEN`](https://redis.io/docs/latest/commands/json.strlen) | [`JSON.ARRAPPEND`](https://redis.io/docs/latest/commands/json.arrappend)"
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "* [The JSON data type](https://redis.io/docs/latest/develop/data-types/json)\n* [JSONPath](https://redis.io/docs/latest/develop/data-types/json/path)\n* [Index and search JSON documents](https://redis.io/docs/latest/develop/ai/search-and-query/indexing)"
    }
  ],
  "examples": []
}
