Cheatsheet Pages / jq Cheatsheet
jq in the real world: shape API responses and count log levels
The two everyday jobs: fetch JSON from an API and shape it on the spot — or reduce a JSON log file to a count per level.
Every filter was executed against the cheatsheet's sample config.json with jq 1.7 before publishing; the sample file sits at the bottom of the cheatsheet so you can reproduce every output.
curl -s https://api.github.com/repos/jqlang/jq | jq '{stars: .stargazers_count, forks: .forks_count}'
# output: { "stars": 21000, "forks": 1500 }
jq -r '.level' app.log | sort | uniq -c
# output: 2 error
# 2 info
