Skip to content

Commit

Permalink
docs: add string to json array (jaywcjlove#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mofelee authored Nov 17, 2022
1 parent d2b0a34 commit 3263edc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/jq.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@ $ echo '42' | jq '"The input was \(.), which is one less than \(.+1)"'
```
<!--rehype:className=wrap-text -->

### 字符串转 JSON 数组

```bash
$ echo 'a b c d' | jq -R 'split(" ")'
```
<!--rehype:className=wrap-text -->

输出结果

```json
[
"a",
"b",
"c",
"d"
]
```
<!--rehype:className=wrap-text -->

另见
----

Expand Down

0 comments on commit 3263edc

Please sign in to comment.