JSON.OBJLEN

Syntax
JSON.OBJLEN key [path]
Available in:
Redis Stack / JSON 1.0.0
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

Reports the number of keys in the JSON Object 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 number of keys in the object, or Null reply if the matching JSON value is not an object.

Examples

redis> JSON.SET doc $ '{"a":[3], "nested": {"a": {"b":2, "c": 1}}}'
OK
redis> JSON.OBJLEN doc $..a
1) (nil)
2) (integer) 2

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.