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.ARRAPPEND

Focus mode
JSON.ARRAPPEND - Amazon MemoryDB

Append one or more values to the array values at the path.

Syntax

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

  • path (required) – a JSON path

  • json (required) – JSON value to be appended to the array

Return

If the path is enhanced syntax:

  • Array of integers, representing the new length of the array at each path.

  • If a value is not an array, its corresponding return value is null.

  • SYNTAXERR error if one of the input json arguments is not a valid JSON string.

  • NONEXISTENT error if the path does not exist.

If the path is restricted syntax:

  • Integer, the array's new length.

  • If multiple array values are selected, the command returns the new length of the last updated array.

  • WRONGTYPE error if the value at the path is not an array.

  • SYNTAXERR error if one of the input json arguments is not a valid JSON string.

  • NONEXISTENT error if the path does not exist.

Examples

Enhanced path syntax:

127.0.0.1:6379> JSON.SET k1 . '[[], ["a"], ["a", "b"]]' OK 127.0.0.1:6379> JSON.ARRAPPEND k1 $[*] '"c"' 1) (integer) 1 2) (integer) 2 3) (integer) 3 127.0.0.1:6379> JSON.GET k1 "[[\"c\"],[\"a\",\"c\"],[\"a\",\"b\",\"c\"]]"

Restricted path syntax:

127.0.0.1:6379> JSON.SET k1 . '[[], ["a"], ["a", "b"]]' OK 127.0.0.1:6379> JSON.ARRAPPEND k1 [-1] '"c"' (integer) 3 127.0.0.1:6379> JSON.GET k1 "[[],[\"a\"],[\"a\",\"b\",\"c\"]]"
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.