Cheatsheet Pages / jq Cheatsheet
How to add a computed field to every JSON object with jq
Each object needs a new field derived from its own data — without changing the originals.
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(. + {senior: (.age >= 30)}) | .[2]' config.json
# output: {"name":"carla","age":34,"role":"user","active":false,"city":"madrid","score":88,"senior":true}
