SmartQueryTools

Aggregate JSON Files Online

Group and aggregate JSON files by any column directly in your browser. Calculate sum, average, min, max, and count for any numeric column — no upload required.

How to aggregate JSON files

  1. Drop your file onto the upload area. The first column is chosen as the Group by column, and every numeric column is set to Sum.
  2. Pick the Group by column. The dropdown shows each column's type. One column is used, and each distinct value becomes one output row.
  3. For each other column, click one function: Sum, Avg, Min, Max or Count. Click the dash to leave a column out.
  4. Click Run Aggregation. The result shows the number of groups, sorted by the group value.
  5. Download the summary table in the same format as your file.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A facilities team exports monthly electricity readings for three sites and wants one line per site for the quarterly report.

Input (JSON)

[
  {
    "site": "Depot North",
    "month": "2026-01",
    "kwh": 1240.5,
    "cost": 310.13
  },
  {
    "site": "Depot North",
    "month": "2026-02",
    "kwh": 1102,
    "cost": 275.5
  },
  {
    "site": "Head Office",
    "month": "2026-01",
    "kwh": 860.25,
    "cost": 215.06
  },
  {
    "site": "Head Office",
    "month": "2026-02",
    "kwh": 912.75,
    "cost": 228.19
  },
  {
    "site": "Depot South",
    "month": "2026-01",
    "kwh": 640,
    "cost": 160
  }
]

Settings

  • Group by: site
  • month: Count
  • kwh: Sum (the default for numeric columns)
  • cost: Avg

Result

sitemonth_countkwh_sumcost_avg
Depot North22342.5292.815
Depot South1640160
Head Office21773221.625

Five readings collapse to one row per site, sorted alphabetically. Each output column is named after its source and function, such as kwh_sum. Count on month counts the non-empty values, so Depot South shows one month of data. Avg is not rounded, so 292.815 keeps all its decimals. Run Round Numbers on the result if needed.

Working with JSON files

Each top-level key is a column. Keys holding JSON numbers are numeric and are set to Sum by default. Keys whose values mix numbers and strings, such as 12 in one object and "12" in another, are not treated as numeric. Fix the source or cast the key first. Objects missing a value key simply do not contribute to that key's result, and objects missing the group key are collected in a group with a null key.

Nested objects cannot be summed and are not useful as group keys. Flatten the JSON first if the value you want to total sits in a field like totals.net. The output is a JSON array with one object per group. Keys are named by source key and function, for example {"site": "Depot North", "kwh_sum": 2342.5}. This makes the file easy to feed into a chart library or a dashboard that expects pre-aggregated data.

Frequently Asked Questions

How do I sum a value inside nested JSON objects?

Flatten the JSON first so the nested field becomes a top-level key, then pick it in the Aggregations list.

What happens to JSON objects that are missing the group key?

They are grouped together under a null key, which is listed last in the result.

Can I group by more than one column?

No. The tool groups by a single column. To group by two, combine them first with Combine Columns, then group by the new column. The SQL workspace supports any number of GROUP BY columns.

Can I apply more than one function to the same column?

No. Each column gets one function per run. To get both the sum and the average of a column, run the tool twice, or use the SQL workspace.

Does Count count rows or values?

Values. Count on a column counts the rows in each group where that column is not empty. Pick a column with no gaps, such as an ID, to get a row count.

Related Tools