Elysia Tools

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

Top Categories

Hubs

Language
ZHDERUPTENFRES

Elysia Tools

Navigation

Data Processing

Invert By

· Last updated:2026-01-30

Invert keys grouped by values using lodash _.invertBy

Details

What this tool helps you do

Group keys by their values or by a transformed value.

Highlights:

  • Uses lodash _.invertBy
  • Groups keys into arrays
  • Optional property path iteratee

Example:

  • Object: {"a":"x","b":"x","c":"y"}
  • Result: {"x":["a","b"],"y":["c"]}

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
Keys17

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, text
Output type
text
Sample coverage
4
API ready
Yes

Overview

The Invert By tool allows you to restructure JSON objects by grouping keys based on their corresponding values. Powered by the lodash _.invertBy method, this utility simplifies data transformation by collecting keys into arrays associated with unique values or transformed property paths.

When to use

  • When you need to categorize a flat list of items by a specific shared attribute.
  • When you want to identify all keys that share the same value within a large JSON dataset.
  • When you need to group nested object properties based on a specific path for easier data analysis.

How it works

  1. 1Paste your source JSON object into the input area.
  2. 2Optionally, provide an 'Iteratee Path' if you want to group by a specific property within the values.
  3. 3Click the process button to generate a new object where values become keys and original keys are grouped into arrays.
  4. 4Copy or download the resulting JSON output for use in your application.

Use cases

  • Aggregating user IDs by their assigned roles or status codes.
  • Organizing configuration settings by their environment or type.
  • Mapping database records to specific categories for faster lookup.

Examples

1. Categorizing User Roles

Background

A developer has a list of users and their roles and needs to generate a list of users per role for a dashboard.

Problem

The current data is structured as {user: role}, but the UI requires {role: [users]}.

How to use

Input the user-role object and run the tool to invert the mapping.

{"Alice":"Admin", "Bob":"Editor", "Charlie":"Admin"}

Outcome

{"Admin":["Alice","Charlie"], "Editor":["Bob"]}

2. Grouping by Nested Property

Background

An API response contains items with nested status information that needs to be grouped.

Problem

Need to group items by the 'status' property located inside a nested object.

How to use

Input the object and specify 'status' in the Iteratee Path field.

FAQ

What does the Invert By tool do?

It transforms an object by swapping its keys and values, grouping all original keys that share the same value into an array.

What is the 'Iteratee Path' used for?

It allows you to group keys based on a specific property path within the values, rather than the values themselves.

Is this tool based on a specific library?

Yes, it utilizes the lodash _.invertBy function to ensure consistent and reliable data processing.

What happens if multiple keys have the same value?

The tool will group all those keys into a single array under that value in the resulting object.

Can I process nested objects?

Yes, by using the Iteratee Path, you can target specific nested properties to determine how the keys should be grouped.

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

Data Visualization

D3.js Data Visualization Samples

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

Developer Tools

Rome JavaScript Toolchain Samples

Rome JavaScript toolchain examples including configuration, linting, formatting, bundling, and project management

Data Processing

Count By

Count items by a derived key using lodash _.countBy

Data Processing

Defaults Deep

Apply deep default values using lodash _.defaultsDeep

Data Processing

Group By

Group items by a derived key using lodash _.groupBy

Data Processing

Invert Object

Invert keys and values using lodash _.invert

{"item1":{"status":"active"}, "item2":{"status":"pending"}, "item3":{"status":"active"}}

Outcome

{"active":["item1","item3"], "pending":["item2"]}