A lightweight and flexible command-line JSON processor.
# To execute the specified expression (print a colored and formatted json):
cat path/to/file.json | jq '.'
# To execute the specified script:
cat path/to/file.json | jq --from-file path/to/script.jq
# To pass the specified arguments:
cat path/to/file.json | jq --arg "name1" "value1" --arg "name2" "value2" '. + $ARGS.named'
# To print the specified keys:
cat path/to/file.json | jq '.key1, .key2'
# To print the specified array items:
cat path/to/file.json | jq '.[index1], .[index2]'
# To print all array items/object keys:
cat path/to/file.json | jq '.[]'
# To add/remove the specified keys:
cat path/to/file.json | jq '. +|- {"key1": "value1", "key2": "value2"}'