Elysia Tools

Browse tools, examples, visual explainers, and topic guides from one clear workspace.

Top Categories

Hubs

Language
ZHDERUPTENFRES

Elysia Tools

Navigation

Data Processing

Count By

· Last updated:2026-01-29

Count items by a derived key using lodash _.countBy

Details

What this tool helps you do

Count items by a derived key from a collection.

Highlights:

  • Uses lodash _.countBy
  • Accepts JSON arrays or objects
  • Supports identity or property/path iteratees

Example:

  • Collection: [{"type":"a"},{"type":"b"},{"type":"a"}]
  • Iteratee: type
  • Result: {"a":2,"b":1}

Execution

Run this tool

Fill in the form, run the tool, and review the result in one place.

Samples

Examples that match this tool

Related

Continue with connected tools and hubs

Written by the Elysia Tools team
Data Processing130
Lodash53
Group18

Tool usage guide

Learn when to use this tool, what it supports, and how real users apply it.

Key facts

Category
Data Processing
Input types
textarea, select, text
Output type
text
Sample coverage
4
API ready
Yes

Overview

Count By is a high-performance utility that aggregates items within a JSON collection based on a specific key or property. Powered by the lodash _.countBy method, it allows you to quickly summarize data distributions and frequency counts without writing custom scripts.

When to use

  • When you need to calculate the frequency of specific categories within a large JSON dataset.
  • When you want to group items by a shared property to understand data composition.
  • When you need a quick summary of object counts based on nested paths or identity values.

How it works

  1. 1Paste your JSON array or object into the collection input field.
  2. 2Select the 'Iteratee Type' to determine if you are counting by identity or a specific property path.
  3. 3Enter the property name or path if you chose the property-based counting method.
  4. 4Execute the tool to receive a JSON object mapping each unique key to its total occurrence count.

Use cases

  • Analyzing survey results to count how many respondents selected each option.
  • Summarizing log files to identify the frequency of specific error codes or status types.
  • Categorizing inventory items to see how many products exist per category or manufacturer.

Examples

1. Counting Product Categories

E-commerce Analyst

Background

An analyst has a list of products and needs to know how many items are in each category.

Problem

Manually counting hundreds of items is prone to error.

How to use

Input the product array and set the iteratee to 'category'.

Collection: [{"id":1,"category":"electronics"},{"id":2,"category":"books"},{"id":3,"category":"electronics"}], Iteratee Type: Property/Path, Iteratee: category

Outcome

{"electronics": 2, "books": 1}

2. Summarizing HTTP Status Codes

Backend Developer

Background

A developer is reviewing server logs to identify the distribution of response codes.

Problem

Need to quickly see how many 200, 404, and 500 errors occurred.

How to use

Paste the log array and count by the 'status' property.

Collection: [{"status":200},{"status":200},{"status":404}], Iteratee Type: Property/Path, Iteratee: status

FAQ

What input formats does Count By support?

The tool accepts standard JSON arrays or JSON objects as input.

What is the difference between Identity and Property/Path?

Identity counts the occurrences of the values themselves, while Property/Path counts occurrences based on a specific key found within the objects.

Can I count by nested properties?

Yes, by selecting Property/Path, you can provide a dot-notation path to access nested values within your objects.

Is this tool based on a specific library?

Yes, this tool utilizes the industry-standard lodash _.countBy function for reliable and consistent data processing.

What is the output format?

The output is a JSON object where keys represent the unique values found and the values represent the count of those items.

Home
Tools3212
Samples593
Visualizations471
Viewers103
Hubs239
Tags333
Images, Audio & Video657

Image, audio, and video processing, conversion, and optimization tools

Math, Date & Finance647

Calculators, numerics, date logic, statistics, and finance tools

Design & Color298

Color, layout, graphics, visual styling, and design helper tools

Text & Writing209

Writing, cleanup, formatting, extraction, and text analysis tools

Developer & Web193

Developer utilities, networking, web debugging, and automation helpers

Conversion & Encoding175

Format, file, archive, unit, and encoding conversion tools

Lead Generation Quiz Launch and Contact Handoff
Memorial Drafts: Family Review and Print Handoff
Private Habit Records: Backup, Restore and Sharing Review
Article to X and LinkedIn Drafts: Fact Review and Handoff
Markdown Interactive Deck Review and Offline Handoff

© 2026 Elysia Tools. All rights reserved.

DocsPricingAboutTerms of ServicePrivacy PolicyCookiesContact
Monitoring

Grafana Advanced Application Samples

Comprehensive Grafana samples covering advanced dashboard design, alerting configurations, data source integrations, and plugin development

Media

QR Code Samples

Sample QR code images for testing QR code reading and generation tools

Testing

Postman Collections - API Testing

Comprehensive Postman collection examples including API testing, automation scripts, environment variables, mock servers, and advanced testing patterns for REST APIs

Data Visualization

D3.js Data Visualization Samples

Comprehensive D3.js data visualization examples including charts, maps, animations, and interactive visualizations

Data Processing

Find Key

Find the first matching key using lodash _.findKey

Data Processing

Get Path

Get a value at a path using lodash _.get

Data Processing

Group By

Group items by a derived key using lodash _.groupBy

Data Processing

Invert By

Invert keys grouped by values using lodash _.invertBy

Outcome

{"200": 2, "404": 1}