Guide for migrating from RESP2 to RESP3 replies

JSON RESP2 to RESP3 replies reference for client developers

In RESP3, the default value of the optional path argument was changed from . to $. Due to this change, the replies of some commands have slightly changed. 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.

JSON command replies comparison

The types are described using a “TypeScript-like” syntax. Array<a> denotes an array where the type of elements is known, but the number of elements is not.

Command RESP2 RESP3
All JSON commands Default value of optional path argument: . Default value of optional path argument: $
JSON.ARRAPPEND
JSON.ARRINDEX
JSON.ARRINSERT
JSON.ARRLEN
JSON.ARRTRIM
JSON.OBJLEN
JSON.STRAPPEND
JSON.STRLEN
JSON.TOGGLE
$-based path argument:
Reply: Array<BulkString | null>

.-based path argument : 
Reply: BulkString
$-based path argument: 
Reply: Array<number | null>

.-based path argument :
Reply: number
JSON.GET Reply: JSON encoded string
Example:
> JSON.SET k $ "[1,2,3]"
> JSON.GET k
"[1,2,3]"
Reply: JSON encoded string with a top-level array
Example:
> JSON.SET k $ "[1,2,3]"
> JSON.GET k
"[[1,2,3]]"
JSON.NUMINCRBY
JSON.NUMMULTBY
$-based path argument:
Reply: JSON-encoded BulkString | null

.-based path argument : 
Reply: BulkString | null | error
$-based path argument:
Reply: Array<number | null> | error

.-based path argument : 
Reply: number | null | error
JSON.OBJKEYS $-based path argument:
Reply: Array<Array<BulkString>>

.-based path argument : 
Reply: Array<BulkString>
$-based path argument:
Reply: Array<Array<BulkString>>

.-based path argument : 
Reply: Array<BulkString>
JSON.TYPE $-based path argument:
Reply: Array<BulkString>
Example:
> JSON.TYPE k $
1) "array"

.-based path argument : 
Reply: BulkString
$-based path argument:
Reply: Array<Array<BulkString>>
Example:
> JSON.TYPE k $
1) 1) "array"

.-based path argument : 
Reply: Array<BulkString>
Rate this page