Skip to content

Commit 5c5ec6b

Browse files
authored
Update json.arrappend.md
- `path` is not optional - small fixes
1 parent 920a8b1 commit 5c5ec6b

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

content/commands/json.arrappend.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ categories:
2424
- clients
2525
complexity: O(1) when path is evaluated to a single value, O(N) when path is evaluated
2626
to multiple values, where N is the size of the key
27-
description: Append one or more json values into the array at path after the last
27+
description: Append one or more JSON values into the array at path after the last
2828
element in it.
2929
group: json
3030
hidden: false
3131
linkTitle: JSON.ARRAPPEND
3232
module: JSON
3333
since: 1.0.0
3434
stack_path: docs/data-types/json
35-
summary: Append one or more json values into the array at path after the last element
35+
summary: Append one or more JSON values into the array at path after the last element
3636
in it.
37-
syntax_fmt: JSON.ARRAPPEND key [path] value [value ...]
37+
syntax_fmt: JSON.ARRAPPEND key path value [value ...]
3838
syntax_str: '[path] value [value ...]'
3939
title: JSON.ARRAPPEND
4040
---
@@ -49,6 +49,11 @@ Append the `json` values into the array at `path` after the last element in it
4949
is key to modify.
5050
</details>
5151

52+
<details open><summary><code>path</code></summary>
53+
54+
is JSONPath to specify.
55+
</details>
56+
5257
<details open><summary><code>value</code></summary>
5358

5459
is one or more values to append to one or more arrays.
@@ -58,16 +63,9 @@ To specify a string as an array value to append, wrap the quoted string with an
5863
{{% /alert %}}
5964
</details>
6065

61-
## Optional arguments
62-
63-
<details open><summary><code>path</code></summary>
64-
65-
is JSONPath to specify. Default is root `$`.
66-
</details>
67-
6866
## Return value
6967

70-
`JSON.ARRAPPEND` 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.
68+
`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.
7169
For more information about replies, see [Redis serialization protocol specification]({{< relref "/develop/reference/protocol-spec" >}}).
7270

7371
## Examples
@@ -82,18 +80,18 @@ redis> JSON.SET item:1 $ '{"name":"Noise-cancelling Bluetooth headphones","descr
8280
OK
8381
{{< / highlight >}}
8482

85-
Add color `blue` to the end of the `colors` array. `JSON.ARRAPPEND` returns the array's new size.
83+
Add color `blue` to the end of the `colors` array. `JSON.ARRAPPEND`; Return the new length of the `colors` array.
8684

8785
{{< highlight bash >}}
8886
redis> JSON.ARRAPPEND item:1 $.colors '"blue"'
8987
1) (integer) 3
9088
{{< / highlight >}}
9189

92-
Return the new length of the `colors` array.
90+
Get the updated value of the `colors` array.
9391

9492
{{< highlight bash >}}
95-
redis> JSON.GET item:1
96-
"{\"name\":\"Noise-cancelling Bluetooth headphones\",\"description\":\"Wireless Bluetooth headphones with noise-cancelling technology\",\"connection\":{\"wireless\":true,\"type\":\"Bluetooth\"},\"price\":99.98,\"stock\":25,\"colors\":[\"black\",\"silver\",\"blue\"]}"
93+
redis> JSON.GET item:1 $.colors
94+
"[[\"black\",\"silver\",\"blue\"]]"
9795
{{< / highlight >}}
9896

9997
</details>

0 commit comments

Comments
 (0)