Group by field jq

Aggregate items by a field value

cat data.json | jq 'group_by(.namespace) | map({ns: .[0].namespace, count: length})'
#jq