Merge two JSON objects jq
Deep-merge two JSON files (override wins)
jq -s '.[0] * .[1]' base.json override.json
more jq
all 17 commands →
Select non-null fields
jq '[.[] | select(.value != null)]' data.json
Group by field
jq 'group_by(.status) | map({status: .[0].status, count: length})' data.json
Flatten nested array
jq 'flatten(1)' nested.json
Convert array to object (index_by)
jq 'INDEX(.[]; .id)' items.json
Merge two objects
jq -s '.[0] * .[1]' base.json override.json