mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-12 19:15:24 +02:00

* pages*: improve page descriptions * ical: improve page description * cockpit-desktop: remove unneeded word from page description * nc: improve description wording --------- Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
32 lines
854 B
Markdown
32 lines
854 B
Markdown
# jq
|
|
|
|
> A JSON processor that uses a domain-specific language (DSL).
|
|
> More information: <https://jqlang.github.io/jq/manual/>.
|
|
|
|
- Execute a specific expression (print a colored and formatted JSON output):
|
|
|
|
`{{cat path/to/file.json}} | jq '.'`
|
|
|
|
- Execute a specific script:
|
|
|
|
`{{cat path/to/file.json}} | jq --from-file {{path/to/script.jq}}`
|
|
|
|
- Pass specific arguments:
|
|
|
|
`{{cat path/to/file.json}} | jq {{--arg "name1" "value1" --arg "name2" "value2" ...}} '{{. + $ARGS.named}}'`
|
|
|
|
- Print specific keys:
|
|
|
|
`{{cat path/to/file.json}} | jq '{{.key1, .key2, ...}}'`
|
|
|
|
- Print specific array items:
|
|
|
|
`{{cat path/to/file.json}} | jq '{{.[index1], .[index2], ...}}'`
|
|
|
|
- Print all array/object values:
|
|
|
|
`{{cat path/to/file.json}} | jq '.[]'`
|
|
|
|
- Add/remove specific keys:
|
|
|
|
`{{cat path/to/file.json}} | jq '. {{+|-}} {{{"key1": "value1", "key2": "value2", ...}}}'`
|