SmartQueryTools

Count Values in JSON Files Online

Group and count rows by any column in JSON files directly in your browser. Sort by frequency or value to find the most common entries — no upload required.

How to count Values in JSON files

  1. Drop your file onto the upload area. The row count is shown and the first column is pre-selected.
  2. Choose a column in the Group by column list.
  3. Pick a sort order: Count (high → low), Count (low → high) or Value (A → Z).
  4. Click Count. The result has two columns, value and count, and the heading shows how many distinct values were found.
  5. Click Download to save the counts in the same format you uploaded, with _countby added to the file name.

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 city bike-share scheme wants to know which docking stations trips start from most often. A few trips from a faulty dock have no start station recorded.

Input (JSON)

[
  {
    "trip_id": 5001,
    "start_station": "Quay St",
    "duration_min": 12,
    "rider_type": "member"
  },
  {
    "trip_id": 5002,
    "start_station": "Park Rd",
    "duration_min": 25,
    "rider_type": "casual"
  },
  {
    "trip_id": 5003,
    "start_station": "Quay St",
    "duration_min": 8,
    "rider_type": "member"
  },
  {
    "trip_id": 5004,
    "start_station": null,
    "duration_min": 17,
    "rider_type": "casual"
  },
  {
    "trip_id": 5005,
    "start_station": "Quay St",
    "duration_min": 31,
    "rider_type": "casual"
  },
  {
    "trip_id": 5006,
    "start_station": "Park Rd",
    "duration_min": 9,
    "rider_type": "member"
  }
]

Settings

  • Group by column: start_station
  • Sort by: Count (high → low)

Result

valuecount
Quay St3
Park Rd2
NULL1

Six trips collapse to three groups. Quay St has three trips, Park Rd two, and the trip with no station forms its own group with a null value. Missing values are counted, not dropped, so the counts always add up to the total row count. The output columns are always named value and count, whatever the source column was called.

Working with JSON files

You can count by any top-level key. Objects that do not have that key are counted in the null group together with objects where it is explicitly null. For an optional field such as "coupon_code", the null group tells you how many records did not use one.

Booleans count into true, false and null groups, which makes this a quick way to check a flag field. Nested keys cannot be chosen directly because only top-level keys appear in the list. Flatten the JSON first to count by a field such as user.plan. The result is saved as a JSON array of objects shaped like {"value": "Quay St", "count": 3}. Key order inside the objects does not affect the result. The counts always add up to the number of objects in the array, which is a quick sanity check against the row count shown on load.

Frequently Asked Questions

Can I count by a nested JSON field?

Not directly. Only top-level keys are offered. Flatten the file so the nested field becomes its own column, then count by it.

What does the JSON output of a count look like?

An array of objects with two keys, value and count, for example [{"value": "Quay St", "count": 3}, ...]. The null group has "value": null.

Can I count by more than one column?

No. The tool groups by one column. For combinations of columns, use the Aggregate tool or the SQL Query tool with GROUP BY on several columns.

How are ties ordered when sorting by count?

Values with the same count have no fixed order between them. Choose Value (A → Z) if you need a stable, alphabetical order.

Does the on-screen table show every value?

The on-screen table shows the first 500 groups. The heading still gives the full number of distinct values, and the downloaded file contains every group.

Related Tools