Skip to content

Commit 0c86f9c

Browse files
uglidedwdoughertychayim
authored
Add RESP3 migration guide (RedisJSON#1100)
Co-authored-by: David Dougherty <david.dougherty@redis.com> Co-authored-by: Chayim <chayim@users.noreply.github.com>
1 parent d23204a commit 0c86f9c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/docs/resp3.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "Guide for migrating from RESP2 to RESP3 replies"
3+
linkTitle: "RESP3 migration guide"
4+
weight: 6
5+
description: JSON RESP2 to RESP3 replies reference for client developers
6+
---
7+
8+
In RESP3, the default value of the optional path argument was changed from `.` to `$`.
9+
Due to this change, the replies of some commands have slightly changed.
10+
This page provides a brief comparison between RESP2 and RESP3 responses for JSON commands to help developers in migrating their clients from RESP2 to RESP3.
11+
12+
### JSON command replies comparison
13+
14+
The types are described using a [“TypeScript-like” syntax](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html). `Array<a>` denotes an [array](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays) where the type of elements is known, but the number of elements is not.
15+
16+
| Command | RESP2 | RESP3 |
17+
|---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
18+
| All JSON commands | **Default value of optional `path` argument**: `.` | **Default value of optional `path` argument:** `$` |
19+
| JSON.ARRAPPEND<br/>JSON.ARRINDEX<br/>JSON.ARRINSERT<br/>JSON.ARRLEN<br/>JSON.ARRTRIM<br/>JSON.OBJLEN<br/>JSON.STRAPPEND<br/>JSON.STRLEN<br/>JSON.TOGGLE | *`$`-based path argument:* <br/> Reply: Array\<BulkString &#124; null> <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: BulkString | *`$`-based path argument:*&nbsp; <br/> Reply: Array\<number &#124; null> <br/><br/> *`.`-based path argument :* <br/> Reply: number |
20+
| JSON.GET | Reply: JSON encoded string <br/> Example: <br/> ```> JSON.SET k $ "[1,2,3]"```<br/> ```> JSON.GET k```<br/>```"[1,2,3]"``` | Reply: JSON encoded string with a top-level array <br/> Example: <br/> ```> JSON.SET k $ "[1,2,3]"```<br/> ```> JSON.GET k```<br/>```"[[1,2,3]]"``` |
21+
| JSON.NUMINCRBY<br/>JSON.NUMMULTBY | *`$`-based path argument:* <br/> Reply: JSON-encoded BulkString &#124; null <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: BulkString &#124; null &#124; error | *`$`-based path argument:* <br/> Reply: Array\<number &#124; null> &#124; error <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: number &#124; null &#124; error |
22+
| JSON.OBJKEYS | *`$`-based path argument:* <br/> Reply: Array\<Array\<BulkString\>> <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: Array\<BulkString> | *`$`-based path argument:* <br/> Reply: Array\<Array\<BulkString\>> <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: Array\<BulkString> |
23+
| JSON.TYPE | *`$`-based path argument:* <br/> Reply: Array\<BulkString\> <br/> Example: <br />```> JSON.TYPE k $```<br />```1) "array"``` <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: BulkString | *`$`-based path argument:* <br/> Reply: Array\<Array\<BulkString\>> <br/> Example: <br />```> JSON.TYPE k $```<br />```1) 1) "array"``` <br/><br/> *`.`-based path argument :*&nbsp;<br/> Reply: Array\<BulkString> |

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy