Appends one or more values to the end of a JSON array at the specified path.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/upstash/redis-js/llms.txt
Use this file to discover all available pages before exploring further.
Usage
Arguments
The key containing the JSON document
JSONPath expression pointing to the array to append to
One or more values to append to the array. Can be any JSON-serializable values.
Response
An array of numbers representing the new length of the array at each matching path. Returns
null for paths that don’t exist or aren’t arrays.Examples
Append single value to array
Append multiple values
Append to nested array
Append objects to array
Append to multiple arrays (wildcard path)
Handle non-existent paths
JSONPath Syntax
$.array- Append to a top-level array$.nested.array- Append to a nested array$.array[0].items- Append to array within array element$..array- Append to all matching arrays recursively$.items[*].tags- Append to arrays within each item
Notes
- The path must point to an existing array. If the path doesn’t exist or points to a non-array value,
nullis returned for that path. - When using wildcard paths, the operation is performed on all matching arrays.
- Values are automatically JSON-serialized before appending.
See Also
- JSON.ARRINDEX - Find index of value in array
- JSON.SET - Set JSON values
- Redis JSON.ARRAPPEND documentation