← All text tools

JSON Array Group By and Aggregate

Group an array of JSON objects by a field and count, sum, average, take the minimum or maximum of other fields without writing code, with a table and JSON result.

  • Free
  • No sign-up
  • Works on any device

About JSON Array Group By and Aggregate

SQL's GROUP BY is often what you want for a JSON export, without loading a database. Paste an array of objects, pick the field to group by, and the page counts the objects in each group and calculates the sum, average, minimum and maximum of the numeric fields you list, or of every numeric field by default. Nested fields can be reached with a dot, such as customer.city. Groups can be sorted by size, name or total, and the result is shown as a table and as JSON you can copy. Numbers are rounded to six decimals.

How to use JSON Array Group By and Aggregate

  1. Paste a JSON array of objects, or an object that contains a single array.
  2. Choose the field to group by and, if you wish, list the fields to total.
  3. Tick the statistics you want, pick a sort order and copy the table or JSON.

Why use this tool?

Also known as

Frequently asked questions

What if the values are numbers stored as text?

Numeric text such as 2.5 in a field you list is read as a number. Entries that are not numbers are ignored in the sums and averages but still counted in the group size.

How are missing values grouped?

Objects without the grouping field, or with null, go into a group called empty in brackets, so every object appears in exactly one group.

Can I group by a nested field?

Yes. Pick it from the list, which includes one level of nested fields written with a dot such as customer.city. You can also type a dotted path in the box of fields to total.

Is JSON Array Group By and Aggregate free?

Yes. JSON Array Group By and Aggregate on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.