# JSON diff

Compare two JSON documents and get the differences as a JSON Patch (RFC 6902).

- Endpoint: `POST https://setget.net/v1/tools/json-diff` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `json-diff`
- Page: https://setget.net/tools/json-diff

## Inputs

- `before` (required, string): The original JSON.
- `after` (required, string): The changed JSON.

## Example

```json
{"input":{"before":"{\"a\":1,\"b\":[1,2],\"c\":true}","after":"{\"a\":2,\"b\":[1,2,3]}"}}
```

Result:

```json
{"equal":false,"patch":[{"op":"remove","path":"/c"},{"op":"replace","path":"/a","value":2},{"op":"add","path":"/b/-","value":3}],"summary":{"add":1,"remove":1,"replace":1}}
```

**Does key order matter?** No. Objects are compared by key, so reordering keys is not a difference.

**How are arrays compared?** Position by position. An item inserted at the start shows as changes to every later position.
