Sum one field across an array of objects.
Section: Grouping and Aggregation
Sum numeric field
bash
bash
echo '[{"amount":10},{"amount":15},{"amount":5}]' | jq 'map(.amount) | add'Explanation
Map to the field first, then aggregate.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Grouping and Aggregation