jq Command Examples

A JSON processor that uses a domain-specific language (DSL). More information: https://jqlang.github.io/jq/manual/.

jq '.' {{/path/to/file.json}}

{{cat path/to/file.json}} | jq --from-file {{path/to/script.jq}}

{{cat path/to/file.json}} | jq {{--arg "name1" "value1" --arg "name2" "value2" ...}} '{{. + $ARGS.named}}'

{{cat path/to/multiple_json_file_*.json}} | jq '{{{newKey1: .key1, newKey2: .key2.nestedKey, ...}}}'

{{cat path/to/file.json}} | jq '{{.[index1], .[index2], ...}}'

{{cat path/to/file.json}} | jq '.[]'

{{cat path/to/file.json}} | jq '.[] | select((.key1=="value1") and .key2=="value2")'

{{cat path/to/file.json}} | jq '. {{+|-}} {{{"key1": "value1", "key2": "value2", ...}}}'