Update jq page with correct command format
This commit is contained in:

committed by
Agniva De Sarker

parent
613e171318
commit
14cefcc7f9
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
- Output all elements from arrays (or all key-value pairs from objects) in a JSON file:
|
- Output all elements from arrays (or all key-value pairs from objects) in a JSON file:
|
||||||
|
|
||||||
`jq .[] {{file.json}}`
|
`jq '.[]' {{file.json}}`
|
||||||
|
|
||||||
- Read JSON objects from a file into an array, and output it (inverse of `jq .[]`):
|
- Read JSON objects from a file into an array, and output it (inverse of `jq .[]`):
|
||||||
|
|
||||||
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
- Output the first element in a JSON file:
|
- Output the first element in a JSON file:
|
||||||
|
|
||||||
`jq .[0] {{file.json}}`
|
`jq '.[0]' {{file.json}}`
|
||||||
|
|
||||||
- Output the value of a given key of the first element in a JSON text from `stdin`:
|
- Output the value of a given key of the first element in a JSON text from `stdin`:
|
||||||
|
|
||||||
`cat {{file.json}} | jq .[0].{{key_name}}`
|
`cat {{file.json}} | jq '.[0].{{key_name}}'`
|
||||||
|
|
||||||
- Output the value of a given key of each element in a JSON text from `stdin`:
|
- Output the value of a given key of each element in a JSON text from `stdin`:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user