# JSON array anti join

`json-array-anti-join` · version 1.0.0 · JSON & JSONL · free, no key needed

Anti join two JSON arrays of objects on exact keys.

**Use when you need to: json array anti join · anti join json arrays · subtract json arrays by keys.**

## Supported

- json array anti join
- anti join json arrays
- subtract json arrays by keys

## Not supported

- fuzzy keys
- numeric keys within arrays

## Behavior

- Matches objects from the left and right arrays based on strict equality of the specified keys.
- Returns a new array containing only the left rows that have NO match in the right array.
- Output array is ordered by the left array's order.
- If a left row is missing any of the join keys, it is treated as having no match, so it is ALWAYS included in the output.
- If a right row is missing any of the join keys, it never matches any left row.

## Input

- `left` (array of object, required): max items 10000
- `right` (array of object, required): max items 10000
- `keys` (array of string, required): min items 1; max items 32; each min length 1

## Output

- `result` (array of object, required)
- `count` (integer, required)

## Limits

- max array items: 10000
- max output items: 10000
- max keys: 32

## Example

Request input:

```json
{
  "left": [
    {
      "id": 1,
      "name": "Alice"
    },
    {
      "id": 2,
      "name": "Bob"
    }
  ],
  "right": [
    {
      "id": 1,
      "role": "Admin"
    }
  ],
  "keys": [
    "id"
  ]
}
```

Response:

```json
{
  "result": {
    "result": [
      {
        "id": 2,
        "name": "Bob"
      }
    ],
    "count": 1
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "json-array-anti-join",
  "version": "1.0.0",
  "input": {
    "left": [
      {
        "id": 1,
        "name": "Alice"
      },
      {
        "id": 2,
        "name": "Bob"
      }
    ],
    "right": [
      {
        "id": 1,
        "role": "Admin"
      }
    ],
    "keys": [
      "id"
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/json-array-anti-join/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"left":[{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}],"right":[{"id":1,"role":"Admin"}],"keys":["id"]}'
```

The machine-readable contract is at [/v1/tools/json-array-anti-join/versions/1.0.0](/v1/tools/json-array-anti-join/versions/1.0.0).

### CLI

```sh
node cli.mjs run json-array-anti-join 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [JSON array inner join](/tools/json-array-inner-join): Inner join two JSON arrays of objects on exact keys.
- [JSON array left join](/tools/json-array-left-join): Left join two JSON arrays of objects on exact keys.
- [JSON array group by](/tools/json-array-group-by): Group an array of JSON objects by exact keys.
- [JSON array group count](/tools/json-array-group-count): Group an array of JSON objects by exact keys and return the count.
- [JSON array sort objects](/tools/json-array-sort-objects): Stably sort an array of objects by explicit string keys using UTF-16 lexicographic order.
- [JSON array concat](/tools/json-array-concat): Concatenate multiple JSON arrays of objects into one.
