Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

JSON Diff API

Compare two JSON documents structurally: lists added, removed, changed and moved values with JSONPath-style paths, plus an RFC 6902 JSON Patch that turns the original into the changed document.

POST /api/v1/tools/json-diffMCP json_diffData & Conversion

Compare two JSON documents by structure, not text. See added, removed and changed paths side by side, match arrays by id, ignore paths and export an RFC 6902 patch.

Input

Send these as a JSON object. Unknown fields are rejected.

original
The original JSON document. (string, required)
changed
The changed JSON document. (string, required)
arrayKey
Match arrays of objects by this field (e.g. "id") instead of by position, so reordered items show as moved, not changed. (string, up to 100 characters, default "")
ignorePaths
Paths to leave out of the comparison, one per line or comma-separated, e.g. $.meta.updatedAt, $.items[*].etag or $..timestamp. (string, up to 5000 characters, default "")
curl https://pithlab.com/api/v1/tools/json-diff \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"original":"{\"name\":\"Ada\",\"roles\":[\"admin\"],\"meta\":{\"updatedAt\":\"2026-01-01\"}}","changed":"{\"name\":\"Ada Lovelace\",\"roles\":[\"admin\",\"editor\"],\"meta\":{\"updatedAt\":\"2026-02-01\"}}","ignorePaths":"$.meta.updatedAt"}'
Example response
{
  "ok": true,
  "result": {
    "identical": false,
    "counts": {
      "added": 1,
      "removed": 0,
      "changed": 1,
      "moved": 0
    },
    "changes": [
      {
        "type": "changed",
        "path": "$.name",
        "oldValue": "Ada",
        "newValue": "Ada Lovelace"
      },
      {
        "type": "added",
        "path": "$.roles[1]",
        "newValue": "editor"
      }
    ],
    "patch": [
      {
        "op": "replace",
        "path": "/name",
        "value": "Ada Lovelace"
      },
      {
        "op": "add",
        "path": "/roles/1",
        "value": "editor"
      }
    ],
    "notes": []
  }
}