Merge two objects jq
Deep merge two JSON objects (right wins on conflicts)
jq -s '.[0] * .[1]' base.json override.json
more jq
all 17 commands →
Extract nested value safely
jq '.config?.database?.host // "localhost"' config.json
Sort by numeric field
jq 'sort_by(.timestamp) | reverse | .[0:5]' events.json
Convert JSON to CSV
jq -r '.[] | [.id, .name, .status] | @csv' data.json
Add field to every element
jq '[.[] | . + {"env": "prod"}]' items.json
Walk and transform all strings
jq 'walk(if type == "string" then ascii_downcase else . end)' data.json