# JSON array left join

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

Left join two JSON arrays of objects on exact keys.

**Use when you need to: json array left join · left join json arrays · left join json objects on keys.**

## Supported

- json array left join
- left join json arrays
- left join json objects on keys

## Not supported

- outer join
- fuzzy keys

## Behavior

- Matches objects from the left and right arrays based on strict equality of the specified keys.
- Returns a new array containing the cartesian product of all matching rows.
- If a left row has no matches, it is included in the output once with only its original properties.
- Output array is ordered first by the left array's order, then by the right array's order.
- If a row is missing any of the join keys, it is treated as having no match (missing keys never match each other).
- A key tuple with more than 64 rows on either side is rejected.

## 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
- max join duplicates: 64

## 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": 1,
        "name": "Alice",
        "role": "Admin"
      },
      {
        "id": 2,
        "name": "Bob"
      }
    ],
    "count": 2
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "json-array-left-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-left-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-left-join/versions/1.0.0](/v1/tools/json-array-left-join/versions/1.0.0).

### CLI

```sh
node cli.mjs run json-array-left-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 anti join](/tools/json-array-anti-join): Anti 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 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.
- [JSON array distinct by](/tools/json-array-distinct-by): Deduplicate a JSON array of objects based on specific keys.
