Skip to content

Commit a451d84

Browse files
Update json.arrappend.md (#1777)
* Update json.arrappend.md - `path` is not optional - small fixes * Update json.arrappend.md (copy-edits) --------- Co-authored-by: David Dougherty <[email protected]>
1 parent 81c3bbd commit a451d84

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

content/commands/json.arrappend.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,34 @@ 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 ...]
38-
syntax_str: '[path] value [value ...]'
37+
syntax_fmt: JSON.ARRAPPEND key path value [value ...]
38+
syntax_str: 'path value [value ...]'
3939
title: JSON.ARRAPPEND
4040
---
41-
Append the `json` values into the array at `path` after the last element in it
41+
Append the JSON values into the array at `path` after the last element in it.
4242

4343
[Examples](#examples)
4444

4545
## Required arguments
4646

4747
<details open><summary><code>key</code></summary>
4848

49-
is key to modify.
49+
is the key to modify.
50+
</details>
51+
52+
<details open><summary><code>path</code></summary>
53+
54+
is the JSONPath to specify.
5055
</details>
5156

5257
<details open><summary><code>value</code></summary>
@@ -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 `blue` to the end of the `colors` array. `JSON.ARRAPPEND` returns 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)