Categories

Intersection Arrays

Find common values across multiple arrays using lodash _.intersection

Find the shared values that appear in every provided array.

Highlights:

  • Uses lodash _.intersection
  • Accepts 2-3 JSON arrays
  • Optional case-insensitive matching for string arrays

Example:

  • Array 1: [1, 2, 3]
  • Array 2: [2, 3, 4]
  • Result: [2, 3]

Enter a JSON array

Enter a JSON array

Optional third array

Uncheck for case-insensitive string matching

Key Facts

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

Overview

The Intersection Arrays tool identifies common values shared across two or three JSON arrays using the lodash _.intersection method. It supports optional case-insensitive matching for string arrays, enabling efficient data comparison and filtering.

When to Use

  • When you need to find overlapping elements between multiple lists or datasets.
  • When comparing arrays to filter out only the shared values for analysis or reporting.
  • When working with string data where case sensitivity might affect the intersection results.

How It Works

  • Enter the first JSON array in the 'Array 1' input field.
  • Enter the second JSON array in the 'Array 2' input field.
  • Optionally, provide a third array in the 'Array 3' field for three-way intersection.
  • Adjust the 'Case Sensitive' checkbox to enable or disable case-insensitive matching for strings.

Use Cases

Data deduplication: Finding common entries across multiple customer or product lists.
Tag comparison: Identifying shared tags or categories in content management systems.
User analysis: Comparing user IDs or emails from different platforms to find overlaps.

Examples

1. Finding Common Product IDs

Background
An e-commerce analyst has two lists of product IDs from different sales channels.
Problem
Need to determine which products are sold in both channels for inventory sync.
How to Use
Input the product ID arrays into Array 1 and Array 2 fields.
Outcome
A JSON array of product IDs common to both lists.

2. Case-Insensitive Username Matching

Software Developer
Background
Comparing usernames from a legacy system and a new system where cases differ.
Problem
Usernames are stored in mixed case, but need to find exact matches ignoring case.
How to Use
Enter the username arrays and uncheck the 'Case Sensitive' option.
Outcome
A list of usernames that match regardless of letter case.

3. Three-List Email Subscriber Intersection

Background
A marketing team has three email lists from different campaigns.
Problem
Want to find subscribers who are common to all three campaigns for targeted outreach.
How to Use
Input the three email arrays into Array 1, Array 2, and Array 3 fields.
Outcome
An array of email addresses present in all three lists.

Try with Samples

json, text

Related Hubs

FAQ

How many arrays can I compare at once?

You can compare two or three arrays simultaneously.

What types of data does it support?

It supports any JSON array, including numbers, strings, and other data types.

Can I perform case-insensitive matching?

Yes, uncheck the 'Case Sensitive' option to ignore case differences in string arrays.

What is the output format?

The result is a JSON array containing the common values from all input arrays.

Is there a limit on the number of elements in arrays?

The tool handles arrays as per standard JSON limits; no specific size restriction is imposed.

API Documentation

Request Endpoint

POST /en/api/tools/intersection-arrays

Request Parameters

Parameter Name Type Required Description
array1 textarea Yes Enter a JSON array
array2 textarea Yes Enter a JSON array
array3 textarea No Optional third array
caseSensitive checkbox No Uncheck for case-insensitive string matching

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-intersection-arrays": {
      "name": "intersection-arrays",
      "description": "Find common values across multiple arrays using lodash _.intersection",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=intersection-arrays",
      "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]