Cheatsheet Pages / jq Cheatsheet

How to build new JSON objects with jq

You need a smaller object picked from one place — or a summary assembled from many places at once.

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.

jq '.users[0] | {name, age}' config.json
# output: { "name": "ana", "age": 28 }
jq '. | {app: .name, owner_email: .owner.email, user_count: (.users | length)}' config.json
# output: { "app": "api-server", "owner_email": "ezra@example.com", "user_count": 3 }
jq Cheatsheet one-page card — 30 filters that actually work
The full one-page card — jq Cheatsheet. Get the complete cheatsheet on GitHub