Skip to main content

A lightweight and flexible command-line JSON processor.

# To execute a specific expression (print a colored and formatted JSON output):
<cat path/to/file.json> | jq '.'

# To execute a specific expression only using the 'jq' binary (print a colored and formatted JSON output):
jq '.' </path/to/file.json>

# To execute a specific script:
<cat path/to/file.json> | jq --from-file <path/to/script.jq>

# To pass specific arguments:
<cat path/to/file.json> | jq <--arg "name1" "value1" --arg "name2" "value2" ...> '<. + $ARGS.named>'

# To print specific keys:
<cat path/to/file.json> | jq '<.key1, .key2, ...>'

# To print specific array items:
<cat path/to/file.json> | jq '<.[index1], .[index2], ...>'

# To print all array/object values:
<cat path/to/file.json> | jq '.[]'

# To add/remove specific keys:
<cat path/to/file.json> | jq '. <+|-> <{"key1": "value1", "key2": "value2", ...>}'