JSON.ARRLEN
Syntax
JSON.ARRLEN key [path]
- Available in:
- Redis Stack / JSON 1.0.0
- Time complexity:
- O(1) where path is evaluated to a single value, O(N) where path is evaluated to multiple values, where N is the size of the key
Reports the length of the JSON Array at path
in key
.
path
defaults to root if not provided. Returns null if the key
or path
do not exist.
Return
Array reply of Integer reply - for each path, the array's length, or Null reply if the matching JSON value is not an array.
Examples
redis> JSON.SET doc $ '{"a":[3], "nested": {"a": [3,4]}}'
OK
redis> JSON.ARRLEN doc $..a
1) (integer) 1
2) (integer) 2
redis> JSON.SET doc $ '{"a":[1,2,3,2], "nested": {"a": false}}'
OK
redis> JSON.ARRLEN doc $..a
1) (integer) 4
2) (nil)
Feedback
If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.