From f4c1150b373dd3b4f4a03277397c59a0306ec0fb Mon Sep 17 00:00:00 2001 From: "David W. Dougherty" Date: Fri, 25 Jul 2025 14:15:10 -0700 Subject: [PATCH] DEV: add RESP2/3 return information to the JSON commands --- content/commands/json.arrappend.md | 23 +++++++++++++++----- content/commands/json.arrindex.md | 23 +++++++++++++++----- content/commands/json.arrinsert.md | 23 +++++++++++++++----- content/commands/json.arrlen.md | 23 +++++++++++++++----- content/commands/json.arrpop.md | 19 ++++++++++++----- content/commands/json.arrtrim.md | 23 +++++++++++++++----- content/commands/json.clear.md | 19 ++++++++++++----- content/commands/json.debug-help.md | 14 +++++++++++-- content/commands/json.debug-memory.md | 19 ++++++++++++----- content/commands/json.del.md | 19 ++++++++++++----- content/commands/json.get.md | 28 ++++++++++++++++++------- content/commands/json.merge.md | 24 +++++++++++++++------ content/commands/json.mget.md | 19 ++++++++++++----- content/commands/json.mset.md | 24 +++++++++++++++------ content/commands/json.numincrby.md | 23 +++++++++++++++----- content/commands/json.nummultby.md | 23 +++++++++++++++----- content/commands/json.objkeys.md | 23 +++++++++++++++----- content/commands/json.objlen.md | 23 +++++++++++++++----- content/commands/json.resp.md | 18 ++++++++++++---- content/commands/json.set.md | 30 +++++++++++++++++---------- content/commands/json.strappend.md | 23 +++++++++++++++----- content/commands/json.strlen.md | 23 +++++++++++++++----- content/commands/json.toggle.md | 23 +++++++++++++++----- content/commands/json.type.md | 23 +++++++++++++++----- 24 files changed, 405 insertions(+), 127 deletions(-) diff --git a/content/commands/json.arrappend.md b/content/commands/json.arrappend.md index f387fecf9..fc847ed40 100644 --- a/content/commands/json.arrappend.md +++ b/content/commands/json.arrappend.md @@ -63,11 +63,6 @@ To specify a string as an array value to append, wrap the quoted string with an {{% /alert %}} -## Return value - -`JSON.ARRAPPEND` returns an [array]({{< relref "develop/reference/protocol-spec#resp-arrays" >}}) of integer replies for each `path` match, the array's new length, or `nil`, if the matching JSON value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -96,6 +91,24 @@ redis> JSON.GET item:1 $.colors
+## Return information + +{{< multitabs id="json-arrappend-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new length, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new length, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.arrindex.md b/content/commands/json.arrindex.md index aba172517..e50c17789 100644 --- a/content/commands/json.arrindex.md +++ b/content/commands/json.arrindex.md @@ -89,11 +89,6 @@ is exclusive stop value to specify in a slice of the array to search, including Out-of-range indexes round to the array's start and end. An inverse index range (such as the range from 1 to 0) returns unfound or `-1`. {{% /alert %}} -## Return value - -`JSON.ARRINDEX` returns an [array]({{< relref "develop/reference/protocol-spec#resp-arrays" >}}) of integer replies for each path, the first position in the array of each JSON value that matches the path, `-1` if unfound in the array, or `nil`, if the matching JSON value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -149,6 +144,24 @@ redis> JSON.ARRINDEX item:1 $..colors '"silver"' {{< / highlight >}}
+## Return information + +{{< multitabs id="json-arrindex-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the first position in the array, `-1` if unfound, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the first position in the array, `-1` if unfound, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the first position in the array, `-1` if unfound, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the first position in the array, `-1` if unfound, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRAPPEND`]({{< relref "commands/json.arrappend/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.arrinsert.md b/content/commands/json.arrinsert.md index 82d1bafb1..83d21e264 100644 --- a/content/commands/json.arrinsert.md +++ b/content/commands/json.arrinsert.md @@ -71,11 +71,6 @@ is position in the array where you want to insert a value. The index must be in is JSONPath to specify. Default is root `$`. -## Return value - -`JSON.ARRINSERT` returns an [array]({{< relref "develop/reference/protocol-spec#resp-arrays" >}}) of integer replies for each path, the array's new size, or `nil`, if the matching JSON value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -124,6 +119,24 @@ redis> JSON.GET item:1 $.colors {{< / highlight >}}
+## Return information + +{{< multitabs id="json-arrinsert-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new size, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new size, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new size, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new size, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRAPPEND`]({{< relref "commands/json.arrappend/" >}}) | [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) diff --git a/content/commands/json.arrlen.md b/content/commands/json.arrlen.md index 6129b00dc..960fa1727 100644 --- a/content/commands/json.arrlen.md +++ b/content/commands/json.arrlen.md @@ -51,11 +51,6 @@ is key to parse. is JSONPath to specify. Default is root `$`, if not provided. Returns null if the `key` or `path` do not exist. -## Return - -`JSON.ARRLEN` returns an [array]({{< relref "develop/reference/protocol-spec#resp-arrays" >}}) of integer replies, an integer for each matching value, each is the array's length, or `nil`, if the matching value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -97,6 +92,24 @@ redis> JSON.GET item:2 '$..max_level'
+## Return information + +{{< multitabs id="json-arrlen-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array length, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array length, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.arrpop.md b/content/commands/json.arrpop.md index 40431b799..c5c461671 100644 --- a/content/commands/json.arrpop.md +++ b/content/commands/json.arrpop.md @@ -65,11 +65,6 @@ is position in the array to start popping from. Default is `-1`, meaning the las is JSONPath to specify. Default is root `$`. -## Return - -`JSON.ARRPOP` returns an [array]({{< relref "develop/reference/protocol-spec#resp-arrays" >}}) of bulk string replies for each path, each reply is the popped JSON value, or `nil`, if the matching JSON value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -118,6 +113,20 @@ redis> JSON.GET key $.[1].max_level {{< / highlight >}}
+## Return information + +{{< multitabs id="json-arrpop-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the popped JSON value as a string, or `null` if the matching value is not an array. + +-tab-sep- + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the popped JSON value as a string, or `null` if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRAPPEND`]({{< relref "commands/json.arrappend/" >}}) | [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) diff --git a/content/commands/json.arrtrim.md b/content/commands/json.arrtrim.md index e4e3fc635..bdeed89be 100644 --- a/content/commands/json.arrtrim.md +++ b/content/commands/json.arrtrim.md @@ -78,11 +78,6 @@ Behavior as of RedisJSON v2.0: * If `stop` is larger than the end of the array, it is treated like the last element. {{% /alert %}} -## Return - -JSON.ARRTRIM returns an array of integer replies for each path, the array's new size, or `nil`, if the matching JSON value is not an array. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -125,6 +120,24 @@ redis> JSON.GET key $.[1].max_level {{< / highlight >}}
+## Return information + +{{< multitabs id="json-arrtrim-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new size, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new size, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the array's new size, or `null` if the matching value is not an array. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the array's new size, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an array. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.clear.md b/content/commands/json.clear.md index f0cf2ef46..d8542c187 100644 --- a/content/commands/json.clear.md +++ b/content/commands/json.clear.md @@ -53,11 +53,6 @@ is key to parse. is JSONPath to specify. Default is root `$`. Nonexisting paths are ignored. -## Return - -JSON.CLEAR returns an integer reply specifying the number of matching JSON arrays and objects cleared + number of matching JSON numerical values zeroed. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - {{% alert title="Note" color="warning" %}} Already cleared values are ignored for empty containers and zero numbers. @@ -91,6 +86,20 @@ redis> JSON.GET doc $ {{< / highlight >}} +## Return information + +{{< multitabs id="json-clear-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of matching JSON arrays and objects cleared plus the number of matching JSON numerical values zeroed. + +-tab-sep- + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of matching JSON arrays and objects cleared plus the number of matching JSON numerical values zeroed. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.debug-help.md b/content/commands/json.debug-help.md index f191df79d..f1f4dc710 100644 --- a/content/commands/json.debug-help.md +++ b/content/commands/json.debug-help.md @@ -24,9 +24,19 @@ title: JSON.DEBUG HELP --- Return helpful information about the [`JSON.DEBUG`]({{< relref "commands/json.debug/" >}}) command -## Return +## Return information -JSON.DEBUG HELP returns an array with helpful messages. +{{< multitabs id="json-debug-help-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing helpful messages about the JSON.DEBUG command. + +-tab-sep- + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing helpful messages about the JSON.DEBUG command. + +{{< /multitabs >}} ## See also diff --git a/content/commands/json.debug-memory.md b/content/commands/json.debug-memory.md index a2b2becfe..b08edbb08 100644 --- a/content/commands/json.debug-memory.md +++ b/content/commands/json.debug-memory.md @@ -55,11 +55,6 @@ is key to parse. is JSONPath to specify. Default is root `$`. -## Return - -JSON.DEBUG MEMORY returns an integer reply specified as the value size in bytes. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -80,6 +75,20 @@ redis> JSON.DEBUG MEMORY item:2 {{< / highlight >}}
+## Return information + +{{< multitabs id="json-debug-memory-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the value size in bytes. + +-tab-sep- + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the value size in bytes. + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.ARRLEN`]({{< relref "commands/json.arrlen/" >}}) diff --git a/content/commands/json.del.md b/content/commands/json.del.md index f585fddc6..30cc40384 100644 --- a/content/commands/json.del.md +++ b/content/commands/json.del.md @@ -58,11 +58,6 @@ Deleting an object's root is equivalent to deleting the key from Redis. {{% /alert %}} -## Return - -JSON.DEL returns an integer reply specified as the number of paths deleted (0 or more). -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -90,6 +85,20 @@ redis> JSON.GET doc $ {{< / highlight >}}
+## Return information + +{{< multitabs id="json-del-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of paths deleted (0 or more). + +-tab-sep- + +[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): the number of paths deleted (0 or more). + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.ARRLEN`]({{< relref "commands/json.arrlen/" >}}) diff --git a/content/commands/json.get.md b/content/commands/json.get.md index c6728fdf0..e3a34f9ba 100644 --- a/content/commands/json.get.md +++ b/content/commands/json.get.md @@ -104,14 +104,6 @@ redis> JSON.GET myjsonkey INDENT "\t" NEWLINE "\n" SPACE " " path.to.value[1] {{% /alert %}} -## Return - -JSON.GET returns a bulk string representing a JSON array of string replies. -Each string is the JSON serialization of each JSON value that matches a path. -Using multiple paths, JSON.GET returns a bulk string representing a JSON object with string values. -Each string value is an array of the JSON serialization of each JSON value that matches a path. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -139,6 +131,26 @@ redis> JSON.GET doc ..a $..b {{< / highlight >}}
+## Return information + +{{< multitabs id="json-get-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): a JSON-encoded string representing the value(s) at the specified path(s). + +With a single path, returns the JSON serialization of the value at that path. +With multiple paths, returns a JSON object where each key is a path and each value is an array of JSON serializations. + +-tab-sep- + +[Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}): a JSON-encoded string with a top-level array containing the value(s) at the specified path(s). + +With a single path using `$` (default in RESP3), returns a JSON array containing the serialized value. +With multiple paths, returns a JSON object where each key is a path and each value is an array of JSON serializations. + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.MGET`]({{< relref "commands/json.mget/" >}}) diff --git a/content/commands/json.merge.md b/content/commands/json.merge.md index bb1047710..e3f990aa1 100644 --- a/content/commands/json.merge.md +++ b/content/commands/json.merge.md @@ -66,12 +66,6 @@ is the JSON value to merge with at the specified path. Merging is done according * merging an existing array with any merged value, replaces the entire array with the value -## Return value - -JSON.MERGE returns a simple string reply: `OK` if executed correctly or `error` if fails to set the new values - -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples JSON.MERGE provides four different behaviors to merge changes on a given key: create a non-existent path, update an existing path with a new value, delete an existing path, or replace an array with a new array @@ -149,6 +143,24 @@ redis> JSON.GET doc +## Return information + +{{< multitabs id="json-merge-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if the operation fails to set the new values. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if the operation fails to set the new values. + +{{< /multitabs >}} + ## See also [`JSON.GET`]({{< relref "commands/json.get/" >}}) | [`JSON.MGET`]({{< relref "commands/json.mget/" >}}) | [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.MSET`]({{< relref "commands/json.mset/" >}}) diff --git a/content/commands/json.mget.md b/content/commands/json.mget.md index 924aeec1a..08c494ae1 100644 --- a/content/commands/json.mget.md +++ b/content/commands/json.mget.md @@ -61,11 +61,6 @@ is JSONPath to specify. Returns `null` for nonexistent paths. -## Return - -JSON.MGET returns an array of bulk string replies specified as the JSON serialization of the value at each key's path. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -89,6 +84,20 @@ redis> JSON.MGET doc1 doc2 $..a {{< / highlight >}}
+## Return information + +{{< multitabs id="json-mget-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the JSON serialization of the value at the corresponding key's path, or `null` if the key or path doesn't exist. + +-tab-sep- + +[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the JSON serialization of the value at the corresponding key's path, or `null` if the key or path doesn't exist. + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.GET`]({{< relref "commands/json.get/" >}}) diff --git a/content/commands/json.mset.md b/content/commands/json.mset.md index 6e20bb660..5ad5bd676 100644 --- a/content/commands/json.mset.md +++ b/content/commands/json.mset.md @@ -71,12 +71,6 @@ is JSONPath to specify. For new Redis keys the `path` must be the root. For exis is value to set at the specified path -## Return value - -JSET.MSET returns a simple string reply: `OK` if executed correctly or `error` if fails to set the new values - -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -96,6 +90,24 @@ redis> JSON.GET doc3 {{< / highlight >}}
+## Return information + +{{< multitabs id="json-mset-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if the operation fails to set the new values. + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if the operation fails to set the new values. + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.MGET`]({{< relref "commands/json.mget/" >}}) | [`JSON.GET`]({{< relref "commands/json.get/" >}}) diff --git a/content/commands/json.numincrby.md b/content/commands/json.numincrby.md index 1f046211e..5fbb837f1 100644 --- a/content/commands/json.numincrby.md +++ b/content/commands/json.numincrby.md @@ -55,11 +55,6 @@ is JSONPath to specify. is number value to increment. -## Return - -JSON.NUMINCRBY returns a bulk string reply specified as a stringified new value for each path, or `nil`, if the matching JSON value is not a number. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -88,6 +83,24 @@ redis> JSON.NUMINCRBY doc $..a 2
+## Return information + +{{< multitabs id="json-numincrby-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing a JSON-encoded string with the new value(s), or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number. + +With `.`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the stringified new value, [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the new value, or `null` if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +With `.`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the stringified new value, [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.nummultby.md b/content/commands/json.nummultby.md index 1bffcc79f..3e8d7802e 100644 --- a/content/commands/json.nummultby.md +++ b/content/commands/json.nummultby.md @@ -58,11 +58,6 @@ is number value to multiply. is JSONPath to specify. Default is root `$`. -## Return - -JSON.NUMMULTBY returns a bulk string reply specified as a stringified new values for each path, or `nil` element if the matching JSON value is not a number. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -74,6 +69,24 @@ redis> JSON.NUMMULTBY doc $..a 2 "[null,4,10,null]" {{< / highlight >}} +## Return information + +{{< multitabs id="json-nummultby-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing a JSON-encoded string with the new value(s), or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number. + +With `.`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the stringified new value, [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the new value, or `null` if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +With `.`-based path argument: [Bulk string reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the stringified new value, [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a number, or [simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) on error. + +{{< /multitabs >}} + ## See also [`JSON.NUMINCRBY`]({{< relref "commands/json.numincrby/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.objkeys.md b/content/commands/json.objkeys.md index 9b9dc9372..c34e327ac 100644 --- a/content/commands/json.objkeys.md +++ b/content/commands/json.objkeys.md @@ -53,11 +53,6 @@ is JSONPath to specify. Default is root `$`. Returns `null` for nonexistant path -## Return - -JSON.OBJKEYS returns an array of array replies for each path, an array of the key names in the object as a bulk string reply, or `nil` if the matching JSON value is not an object. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -69,6 +64,24 @@ redis> JSON.OBJKEYS doc $..a 2) "c" {{< / highlight >}} +## Return information + +{{< multitabs id="json-objkeys-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [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 key names in the object, or `null` if the matching value is not an object. + +With `.`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing the key names in the object, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an object. + +-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 key names in the object, or `null` if the matching value is not an object. + +With `.`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) containing the key names in the object, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an object. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.objlen.md b/content/commands/json.objlen.md index 9401d7b1a..ac3e71c10 100644 --- a/content/commands/json.objlen.md +++ b/content/commands/json.objlen.md @@ -52,11 +52,6 @@ is JSONPath to specify. Default is root `$`. Returns `null` for nonexistant path -## Return - -JSON.OBJLEN returns an array of integer replies for each path specified as the number of keys in the object or `nil`, if the matching JSON value is not an object. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -67,6 +62,24 @@ redis> JSON.OBJLEN doc $..a 2) (integer) 2 {{< / highlight >}} +## Return information + +{{< multitabs id="json-objlen-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the number of keys in the object, or `null` if the matching value is not an object. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the number of keys in the object, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an object. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the number of keys in the object, or `null` if the matching value is not an object. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the number of keys in the object, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not an object. + +{{< /multitabs >}} + ## See also [`JSON.ARRINDEX`]({{< relref "commands/json.arrindex/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.resp.md b/content/commands/json.resp.md index 71087a197..e76da4612 100644 --- a/content/commands/json.resp.md +++ b/content/commands/json.resp.md @@ -62,10 +62,6 @@ is JSONPath to specify. Default is root `$`. This command uses the following map For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). -## Return - -JSON.RESP returns an array reply specified as the JSON's RESP form detailed in [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -109,6 +105,20 @@ redis> JSON.RESP item:2 {{< / highlight >}}
+## Return information + +{{< 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 >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.ARRLEN`]({{< relref "commands/json.arrlen/" >}}) diff --git a/content/commands/json.set.md b/content/commands/json.set.md index aef20bde9..68e771b4e 100644 --- a/content/commands/json.set.md +++ b/content/commands/json.set.md @@ -81,17 +81,6 @@ sets the key only if it does not already exist. sets the key only if it already exists. -## Return value - -Returns one of these replies: -- A simple string reply: `OK` if executed correctly -- `nil` - - if `key` exists but `path` does not exist and cannot be created - - if an `NX` or `XX` condition is unmet -- error if `key` does not exist and `path` is not root (`.` or `$`) - -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -164,6 +153,25 @@ redis> JSON.SET nonexistentkey $.x 5 {{< / highlight >}}
+## Return information + +{{< multitabs id="json-set-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}): if `key` exists but `path` does not exist and cannot be created, or if an `NX` or `XX` condition is unmet. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if `key` does not exist and `path` is not root (`.` or `$`). + +-tab-sep- + +One of the following: +* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}): `OK` if executed correctly. +* [Null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}): if `key` exists but `path` does not exist and cannot be created, or if an `NX` or `XX` condition is unmet. +* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}): if `key` does not exist and `path` is not root (`.` or `$`). + +{{< /multitabs >}} ## See also diff --git a/content/commands/json.strappend.md b/content/commands/json.strappend.md index 24fbc3e85..311366b54 100644 --- a/content/commands/json.strappend.md +++ b/content/commands/json.strappend.md @@ -62,11 +62,6 @@ To specify a string as an array value to append, wrap the quoted string with an is JSONPath to specify. Default is root `$`. -## Return value - -JSON.STRAPPEND returns an array of integer replies for each path, the string's new length, or `nil`, if the matching JSON value is not a string. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -80,6 +75,24 @@ redis> JSON.GET doc $ "[{\"a\":\"foobaz\",\"nested\":{\"a\":\"hellobaz\"},\"nested2\":{\"a\":31}}]" {{< / highlight >}} +## Return information + +{{< multitabs id="json-strappend-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the string's new length, or `null` if the matching value is not a string. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the string's new length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a string. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the string's new length, or `null` if the matching value is not a string. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the string's new length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a string. + +{{< /multitabs >}} + ## See also `JSON.ARRAPEND` | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.strlen.md b/content/commands/json.strlen.md index eafc70e61..dfb949981 100644 --- a/content/commands/json.strlen.md +++ b/content/commands/json.strlen.md @@ -51,11 +51,6 @@ is key to parse. is JSONPath to specify. Default is root `$`, if not provided. Returns null if the `key` or `path` do not exist. -## Return - -JSON.STRLEN returns by recursive descent an array of integer replies for each path, the string's length, or `nil`, if the matching JSON value is not a string. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -67,6 +62,24 @@ redis> JSON.STRLEN doc $..a 3) (nil) {{< / highlight >}} +## Return information + +{{< multitabs id="json-strlen-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the string's length, or `null` if the matching value is not a string. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the string's length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a string. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the string's length, or `null` if the matching value is not a string. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the string's length, or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not a string. + +{{< /multitabs >}} + ## See also [`JSON.ARRLEN`]({{< relref "commands/json.arrlen/" >}}) | [`JSON.ARRINSERT`]({{< relref "commands/json.arrinsert/" >}}) diff --git a/content/commands/json.toggle.md b/content/commands/json.toggle.md index 82118b4e6..cabb29e4b 100644 --- a/content/commands/json.toggle.md +++ b/content/commands/json.toggle.md @@ -51,11 +51,6 @@ is JSONPath to specify. Default is root `$`. -## Return - -JSON.TOGGLE returns an array of integer replies for each path, the new value (`0` if `false` or `1` if `true`), or `nil` for JSON values matching the path that are not Boolean. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples
@@ -97,6 +92,24 @@ redis> JSON.GET doc $ {{< / highlight >}}
+## Return information + +{{< multitabs id="json-toggle-return-info" + tab1="RESP2" + tab2="RESP3" >}} + +With `$`-based path argument: [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the new value (`0` if `false` or `1` if `true`), or `null` if the matching value is not Boolean. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the new value (`0` if `false` or `1` if `true`), or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not Boolean. + +-tab-sep- + +With `$`-based path argument (default): [Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [integer replies]({{< relref "/develop/reference/protocol-spec#integers" >}}) or [null replies]({{< relref "/develop/reference/protocol-spec#nulls" >}}), where each element is the new value (`0` if `false` or `1` if `true`), or `null` if the matching value is not Boolean. + +With `.`-based path argument: [Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}) representing the new value (`0` if `false` or `1` if `true`), or [null reply]({{< relref "/develop/reference/protocol-spec#nulls" >}}) if the matching value is not Boolean. + +{{< /multitabs >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.GET`]({{< relref "commands/json.get/" >}}) diff --git a/content/commands/json.type.md b/content/commands/json.type.md index afeaa6a84..f189bebec 100644 --- a/content/commands/json.type.md +++ b/content/commands/json.type.md @@ -52,11 +52,6 @@ is JSONPath to specify. Default is root `$`. Returns null if the `key` or `path` -## Return - -JSON.TYPE returns an array of string replies for each path, specified as the value's type. -For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}). - ## Examples {{< highlight bash >}} @@ -71,6 +66,24 @@ redis> JSON.TYPE doc $..dummy (empty array) {{< / highlight >}} +## Return information + +{{< 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 >}} + ## See also [`JSON.SET`]({{< relref "commands/json.set/" >}}) | [`JSON.ARRLEN`]({{< relref "commands/json.arrlen/" >}})