JSON.OBJKEYS
Syntax
JSON.OBJKEYS key [path]
- Available in:
- Redis Stack / JSON 1.0.0
- Time complexity:
- O(N) when path is evaluated to a single value, where N is the number of keys in the object, O(N) when path is evaluated to multiple values, where N is the size of the key
Returns the keys in the object that's referenced by path
.
path
defaults to root if not provided. Returns null if the object is empty or either key
or path
do not exist.
Return
Array reply of Array reply - for each path, an array of the key names in the object as Bulk string reply, 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.OBJKEYS doc $..a
1) (nil)
2) 1) "b"
2) "c"
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.