# JSON deep equal

`json-deep-equal` · version 1.0.0 · JSON & JSONL · free, no key needed

JSON-only structural equality. Object key order does not matter; array order does.

**Use when you need to: json deep equal · json equals · structural json equality.**

## Supported

- json deep equal
- json equals
- structural json equality

## Not supported

- reference equality
- date compare
- json patch
- epsilon floats

## Behavior

- Accept only JSON values: null, boolean, finite number, string, array, and plain objects.
- Reject NaN, Infinity, -Infinity, undefined, BigInt, functions, symbols, Date, Map, Set, RegExp, boxed primitives, Buffer, and sparse holes.
- Canonicalize -0 to 0.
- Objects may have null or Object.prototype; comparison uses own enumerable string keys only.
- Treat __proto__, constructor, and toString as ordinary own keys. Never mutate Object.prototype.
- Output objects are Object.create(null). Returned JSON values are deep-cloned.
- Bound walk: max depth 32, max nodes 10000 per value.
- null, booleans, and strings compare with === after JSON validation.
- Numbers compare with Object.is after canonicalizing -0 to 0. No epsilon.
- Arrays require the same length and pairwise equality. Objects require the same own-key set and equal values; key insertion order is ignored.
- Prototype-like keys are ordinary own keys.

## Input

- `a` (any JSON value, required)
- `b` (any JSON value, required)

## Output

- `equal` (boolean, required)

## Limits

- max json depth: 32
- max json nodes: 10000

## Example

Request input:

```json
{
  "a": {
    "k": 1,
    "m": 2
  },
  "b": {
    "m": 2,
    "k": 1
  }
}
```

Response:

```json
{
  "result": {
    "equal": true
  }
}
```

## How to call it

### MCP

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

```json
{
  "id": "json-deep-equal",
  "version": "1.0.0",
  "input": {
    "a": {
      "k": 1,
      "m": 2
    },
    "b": {
      "m": 2,
      "k": 1
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/json-deep-equal/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"a":{"k":1,"m":2},"b":{"m":2,"k":1}}'
```

The machine-readable contract is at [/v1/tools/json-deep-equal/versions/1.0.0](/v1/tools/json-deep-equal/versions/1.0.0).

### CLI

```sh
node cli.mjs run json-deep-equal 1.0.0 --input input.json --base-url https://computefirst.net
```

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

## Related tools

- [JSON deep diff](/tools/json-deep-diff): Bounded deterministic JSON difference records. Not a JSON Patch implementation.
- [JSON array filter equals](/tools/json-array-filter-equals): Filter JSON array objects where a key equals a specific value.
- [Array to JSONL](/tools/array-to-jsonl): Serialize an array of JSON-safe values as JSON Lines text.
- [JSON array anti join](/tools/json-array-anti-join): Anti join two JSON arrays of objects on exact keys.
- [JSON array concat](/tools/json-array-concat): Concatenate multiple JSON arrays of objects into one.
- [JSON array count](/tools/json-array-count): Count structural occurrences in a JSON array in first-seen order.
