Group by field jq
Count records grouped by status field
jq 'group_by(.status) | map({status: .[0].status, count: length})' data.json
more jq
all 17 commands →
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
Extract nested value safely
jq '.config?.database?.host // "localhost"' config.json
Sort by numeric field
jq 'sort_by(.timestamp) | reverse | .[0:5]' events.json