JSON.ARRAPPEND key [path] value [value ...]

Available in: Redis Stack

Time complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated to multiple values, where N is the size of the key

Append the json values into the array at path after the last element in it.


[] if the matching JSON value is not an array.


redis> JSON.SET doc $ '{"a":[1], "nested": {"a": [1,2]}, "nested2": {"a": 42}}'
redis> JSON.ARRAPPEND doc $..a 3 4
1) (integer) 3
2) (integer) 4
3) (nil)
redis> JSON.GET doc $