content/commands/json.type.md
Report the type of JSON value at path
is key to parse.
</details>is JSONPath to specify. Default is root $. Returns null if the key or path do not exist.
{{< highlight bash >}} redis> JSON.SET doc $ '{"a":2, "nested": {"a": true}, "foo": "bar"}' OK redis> JSON.TYPE doc $..foo
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Supported</span> | <span title="Supported">✅ Flexible & Annual</span> <span title="Supported">✅ Free & Fixed</nobr></span> | |
{{< multitabs id="json-type-return-info" tab1="RESP2" tab2="RESP3" >}}
With $-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), where each element is the type of the matching value.
With .-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the type of the matching value.
-tab-sep-
With $-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [array replies]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}), where each nested array contains the type of the matching value.
With .-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the type of the matching value.
{{< /multitabs >}}
[JSON.SET]({{< relref "commands/json.set/" >}}) | [JSON.ARRLEN]({{< relref "commands/json.arrlen/" >}})