JSON.TYPE key [path]

Available in: Redis Stack

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 type of JSON value at path.

path defaults to root if not provided. Returns null if the key or path do not exist.

Return

[] - for each path, the value's type.

Examples

redis> JSON.SET doc $ '{"a":2, "nested": {"a": true}, "foo": "bar"}'
OK
redis> JSON.TYPE doc $..foo
1) "string"
redis> JSON.TYPE doc $..a
1) "integer"
2) "boolean"
redis> JSON.TYPE doc $..dummy
(empty array)