JSON.TYPE

Syntax

  1. JSON.TYPE key [path]

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

Report the type of JSON value at path

Examples

Required arguments

key

is key to parse.

Optional arguments

path

is JSONPath to specify. Default is root $. Returns null if the key or path do not exist.

Return

JSON.TYPE returns an array of string replies for each path, specified as the value’s type. For more information about replies, see Redis serialization protocol specification.

Examples

  1. dragonfly> JSON.SET doc $ '{"a":2, "nested": {"a": true}, "foo": "bar"}'
  2. OK
  3. dragonfly> JSON.TYPE doc $..foo
  4. 1) "string"
  5. dragonfly> JSON.TYPE doc $..a
  6. 1) "integer"
  7. 2) "boolean"
  8. dragonfly> JSON.TYPE doc $..dummy
  9. (nil)

See also

JSON.SET | JSON.ARRLEN