Categories

Xor Arrays

Compute the symmetric difference of arrays using lodash _.xor

Return values that appear in only one of the provided arrays.

Highlights:

  • Uses lodash _.xor
  • Accepts 2-4 JSON arrays
  • Useful for symmetric differences

Example:

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

Enter a JSON array

Enter a JSON array

Optional third array

Optional fourth array

Key Facts

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

Overview

The Xor Arrays tool allows you to quickly compute the symmetric difference between multiple datasets by identifying values that appear in exactly one of the provided JSON arrays.

When to Use

  • When you need to identify unique items present in one list but missing from another.
  • When comparing two or more datasets to find non-overlapping elements.
  • When cleaning data by isolating values that do not share commonality across multiple groups.

How It Works

  • Input your data as valid JSON arrays into the provided fields.
  • The tool utilizes the lodash _.xor function to process the inputs.
  • The system calculates the symmetric difference and returns a single array containing only the unique values.

Use Cases

Comparing user ID lists from two different databases to find missing records.
Identifying unique configuration settings between two environment files.
Filtering out common items from multiple inventory lists to see what is exclusive to each.

Examples

1. Comparing User Access Lists

System Administrator
Background
I have two lists of user IDs from different departments and need to see which users are not shared between them.
Problem
Manually checking hundreds of IDs for discrepancies is prone to human error.
How to Use
Paste the first list into Array 1 and the second list into Array 2, then run the tool.
Example Config
Array 1: [101, 102, 103], Array 2: [102, 103, 104]
Outcome
The tool returns [101, 104], highlighting the IDs that are unique to each list.

2. Syncing Product Inventories

E-commerce Manager
Background
I need to find which products are listed in my warehouse system but missing from my online store catalog.
Problem
Identifying non-matching product SKUs across two separate JSON exports.
How to Use
Input the warehouse SKU array and the online store SKU array to isolate the differences.
Example Config
Array 1: ["SKU-A", "SKU-B"], Array 2: ["SKU-B", "SKU-C"]
Outcome
The tool returns ["SKU-A", "SKU-C"], showing which items are not present in both systems.

Try with Samples

json

Related Hubs

FAQ

What is a symmetric difference?

A symmetric difference consists of elements that are in either of the sets, but not in their intersection.

How many arrays can I compare at once?

You can compare between 2 and 4 JSON arrays simultaneously.

What format should my input be in?

Inputs must be valid JSON arrays, such as [1, 2, 3] or ["apple", "banana"].

Does the order of the arrays matter?

No, the symmetric difference operation is commutative, so the order of the arrays does not change the result.

What happens if I provide duplicate values within a single array?

The tool processes the arrays based on the behavior of lodash _.xor, which focuses on the presence of values across the provided sets.

API Documentation

Request Endpoint

POST /en/api/tools/xor-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
array4 textarea No Optional fourth 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-xor-arrays": {
      "name": "xor-arrays",
      "description": "Compute the symmetric difference of arrays using lodash _.xor",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=xor-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]