docs: add string to json array (#114)

This commit is contained in:
mofelee 2022-11-17 16:22:41 +08:00 committed by GitHub
parent d2b0a34e69
commit 3263edca0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 -->
另见
----