Cheatsheet Pages / jq Cheatsheet

How to keep only some fields of every object with jq map

The objects carry more than you need downstream — trim each one to the fields that matter.

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 -c '.users | map({name, city})' config.json
# output: [{"name":"ana","city":"madrid"},{"name":"bruno","city":"lisboa"},{"name":"carla","city":"madrid"}]
jq Cheatsheet one-page card — 30 filters that actually work
The full one-page card — jq Cheatsheet. Get the complete cheatsheet on GitHub