Categories

Uniq With

Remove duplicates using lodash _.uniqWith and deep equality

Remove duplicates using a deep equality comparator.

Highlights:

  • Uses lodash _.uniqWith
  • Compares items with _.isEqual
  • Useful for arrays of objects

Example:

  • Array: [{"id": 1}, {"id": 1}, {"id": 2}]
  • Result: [{"id": 1}, {"id": 2}]

Enter a JSON array

Key Facts

Category
Data Processing
Input Types
textarea
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

Uniq With is a powerful data processing utility that removes duplicate entries from JSON arrays by performing a deep equality comparison using the lodash library.

When to Use

  • When you need to clean up arrays of objects that contain identical data structures.
  • When standard unique filters fail because they only compare object references rather than content.
  • When you want to ensure data integrity by removing redundant records from a JSON dataset.

How It Works

  • Paste your JSON array into the input field.
  • The tool utilizes the lodash _.uniqWith function to iterate through your data.
  • It applies _.isEqual to perform a deep comparison of every object property.
  • The tool returns a cleaned array containing only unique, non-redundant objects.

Use Cases

Cleaning API response data that contains duplicate user or product records.
Merging multiple data sources into a single, unique list of configuration objects.
Preparing clean datasets for frontend state management or data visualization.

Examples

1. Cleaning User List

Frontend Developer
Background
An API call returned a list of users, but some entries were duplicated due to a backend sync issue.
Problem
The UI was rendering duplicate user cards, causing a poor user experience.
How to Use
Paste the JSON array of user objects into the input field to filter out the redundant entries.
Example Config
[{"id": 101, "name": "Alice"}, {"id": 101, "name": "Alice"}, {"id": 102, "name": "Bob"}]
Outcome
The tool returned a clean array: [{"id": 101, "name": "Alice"}, {"id": 102, "name": "Bob"}].

2. Deduplicating Product Inventory

Data Analyst
Background
Two different inventory logs were merged, resulting in multiple entries for the same product SKU and attributes.
Problem
The total inventory count was inflated because of the duplicate entries.
How to Use
Input the merged JSON array to remove objects that share identical SKU and category properties.
Example Config
[{"sku": "A1", "price": 20}, {"sku": "B2", "price": 50}, {"sku": "A1", "price": 20}]
Outcome
The tool successfully removed the duplicate 'A1' entry, leaving a list of unique products.

Try with Samples

json, video

Related Hubs

FAQ

What makes this different from a standard unique filter?

Standard filters often compare object references. This tool uses deep equality, meaning it compares the actual values inside the objects.

Does this tool support nested objects?

Yes, because it uses lodash's deep equality check, it can accurately identify duplicates even within nested structures.

What format should my input be in?

The input must be a valid JSON array of objects or values.

Is the comparison case-sensitive?

Yes, the deep equality check treats strings with different casing as distinct values.

Can I use this for large datasets?

It is highly efficient for most standard web-based data tasks, though performance may vary depending on the complexity and size of the objects.

API Documentation

Request Endpoint

POST /en/api/tools/uniq-with

Request Parameters

Parameter Name Type Required Description
array textarea Yes Enter a JSON array

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-uniq-with": {
      "name": "uniq-with",
      "description": "Remove duplicates using lodash _.uniqWith and deep equality",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=uniq-with",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]