jq
jq is a command-line tool and language for filtering and transforming JSON. Filters are joined with a pipe (|), so each stage feeds the next, as in jq '.items[] | .name'. It is common in shell scripts and CI pipelines for reshaping API responses.
In more detail
jq is a command-line program and a small language for processing JSON. You give it a filter and some JSON, and it prints the result. It reads from files or standard input, so it fits into shell pipelines and CI scripts.
A filter is built from small parts joined with a pipe, |. . is the input, .key reads a field, .[] iterates over an array, select() keeps values that pass a test, and {} or [] build new JSON. Each part receives the output of the one before it.
Unlike JSONPath, which only selects values, jq can reshape, count, group, sort and compute. Flags change the output: -r prints raw strings, -c prints compact JSON and -s reads every input into one array.
Example
# Names of active users, one per line
jq -r '.users[] | select(.active) | .name' users.json
# Count the users
jq '.users | length' users.json
# Keep two fields from each user
jq '.users | map({id, name})' users.jsonTry it
Learn more in the guide jq cheat sheet: filters, select, map and examples.
← Back to jq in the JSON glossaryUpdated 2026-10-01