content/commands/json.resp.md
Return the JSON in key in [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}) form
is key to parse.
</details>is JSONPath to specify. Default is root $. This command uses the following mapping from JSON to RESP:
null maps to the bulk string reply.false and true values map to the simple string reply.[, followed by the array's elements.{. Each successive entry represents a key-value pair as a two-entry array reply of the bulk string reply.For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}).
</details>Create a JSON document.
{{< highlight bash >}} redis> JSON.SET item:2 $ '{"name":"Wireless earbuds","description":"Wireless Bluetooth in-ear headphones","connection":{"wireless":true,"type":"Bluetooth"},"price":64.99,"stock":17,"colors":["black","white"], "max_level":[80, 100, 120]}' OK {{< / highlight >}}
Get all RESP details about the document.
{{< highlight bash >}} redis> JSON.RESP item:2
| 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-resp-return-info" tab1="RESP2" tab2="RESP3" >}}
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) representing the JSON value in RESP form, as detailed in the [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). The mapping from JSON to RESP follows the rules described in the command arguments.
-tab-sep-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) representing the JSON value in RESP form, as detailed in the [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). The mapping from JSON to RESP follows the rules described in the command arguments.
{{< /multitabs >}}
[JSON.SET]({{< relref "commands/json.set/" >}}) | [JSON.ARRLEN]({{< relref "commands/json.arrlen/" >}})