jq length

1 개요[ | ]

jq length
  • 문자열 또는 리스트의 길이
root@wsl:~# echo '"hello"'
"hello"
root@wsl:~# echo '"hello"' | jq length
5
root@wsl:~# echo '[1,2,3]'
[1,2,3]
root@wsl:~# echo '[1,2,3]' | jq length
3

root@wsl:~# cat a.json
[{"name":"JSON", "good":true}, {"name":"XML", "good":false}]
root@wsl:~# cat a.json | jq length
2
root@wsl:~# cat a.json | jq -c '.[]'
{"name":"JSON","good":true}
{"name":"XML","good":false}
root@wsl:~# cat a.json | jq '.[] | length'
2
2

root@wsl:~# cat b.json
[[1,2], "string", {"a":2}, null]
root@wsl:~# cat b.json | jq 'length'
4
root@wsl:~# cat b.json | jq -c '.[]'
[1,2]
"string"
{"a":2}
null
root@wsl:~# cat b.json | jq '.[] | length'
2
6
1
0

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}