You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commands/json.get.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,11 @@ is JSONPath to specify. Default is root `$`. JSON.GET accepts multiple `path` ar
17
17
18
18
{{% alert title="Note" color="warning" %}}
19
19
20
-
When using a JSONPath, the root of the matching values is always an array. In contrast, the legacy path returns a single value.
20
+
When using a single JSONPath, the root of the matching values is a JSON string with a top-level **array** of serialized JSON value.
21
+
In contrast, a legacy path returns a single value.
22
+
23
+
When using multiple JSONPath arguments, the root of the matching values is a JSON string with a top-level **object**, with each object value being a top-level array of serialized JSON value.
24
+
In contrast, if all paths are legacy paths, each object value is a single serialized JSON value.
21
25
If there are multiple paths that include both legacy path and JSONPath, the returned value conforms to the JSONPath version (an array of values).
22
26
23
27
{{% /alert %}}
@@ -52,7 +56,10 @@ Produce pretty-formatted JSON with `redis-cli` by following this example:
52
56
53
57
## Return
54
58
55
-
JSON.GET returns an array of bulk string replies. Each string is the JSON serialization of each JSON value that matches a path.
59
+
JSON.GET returns a bulk string representing a JSON array of string replies.
60
+
Each string is the JSON serialization of each JSON value that matches a path.
61
+
Using multiple paths, JSON.GET returns a bulk string representing a JSON object with string values.
62
+
Each string value is an array of the JSON serialization of each JSON value that matches a path.
56
63
For more information about replies, see [Redis serialization protocol specification](/docs/reference/protocol-spec).
57
64
58
65
## Examples
@@ -63,7 +70,7 @@ For more information about replies, see [Redis serialization protocol specificat
Copy file name to clipboardExpand all lines: docs/docs/path.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,9 +11,12 @@ RedisJSON supports two query syntaxes: [JSONPath syntax](#jsonpath-syntax) and t
11
11
12
12
RedisJSON knows which syntax to use depending on the first character of the path query. If the query starts with the character `$`, it uses JSONPath syntax. Otherwise, it defaults to the legacy path syntax.
13
13
14
+
The returned value is a JSON string with a top-level array of JSON serialized strings.
15
+
And if multi-paths are used, the return value is a JSON string with a top-level object with values that are arrays of serialized JSON values.
16
+
14
17
## JSONPath support
15
18
16
-
RedisJSON v2.0 introduces[JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
19
+
RedisJSON v2.0 introduced[JSONPath](http://goessner.net/articles/JsonPath/) support. It follows the syntax described by Goessner in his [article](http://goessner.net/articles/JsonPath/).
17
20
18
21
A JSONPath query can resolve to several locations in a JSON document. In this case, the JSON commands apply the operation to every possible location. This is a major improvement over [legacy path](#legacy-path-syntax) queries, which only operate on the first path.
0 commit comments