JSON.OBJKEYS

Syntax

  1. JSON.OBJKEYS key [path]

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

Return the keys in the object that’s referenced by path

Examples

Required arguments

key

is key to parse. Returns null for nonexistent keys.

Optional arguments

path

is JSONPath to specify. Default is root $. Returns null for nonexistant path.

Return

JSON.OBJKEYS returns an array of array replies for each path, an array of the key names in the object as a bulk string reply, or nil if the matching JSON value is not an object. For more information about replies, see Redis serialization protocol specification.

Examples

  1. dragonfly> JSON.SET doc $ '{"a":[3], "nested": {"a": {"b":2, "c": 1}}}'
  2. OK
  3. dragonfly> JSON.OBJKEYS doc $..a
  4. 1) (nil)
  5. 2) 1) "b"
  6. 2) "c"

See also

JSON.ARRINDEX | JSON.ARRINSERT