JSON Diff

Compare two JSON objects and list what was added, removed and changed, with paths and values.

Pay by wallet (x402) diff-json

Example

Example answer
{
  "added": [
    {
      "path": "/email",
      "value": "[email protected]"
    }
  ],
  "changed": [
    {
      "path": "/version",
      "new_value": 2,
      "old_value": 1
    }
  ],
  "removed": [],
  "identical": false,
  "added_count": 1,
  "changed_count": 1,
  "removed_count": 0
}

Inputs

FieldTypeRequiredWhat it is
afteranyYesModified JSON
beforeanyYesOriginal JSON

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
addedarrayAlways (present in every successful answer)
changedarrayAlways (present in every successful answer)
removedarrayAlways (present in every successful answer)
identicalbooleanAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "diff-json",
    "inputs": {
      "after": {
        "name": "Alice",
        "email": "[email protected]",
        "version": 2
      },
      "before": {
        "name": "Alice",
        "version": 1
      }
    },
    "max_price_cents": 3
  }'

Limitations

  • Different value formats count as differences

    Computes structural diff — semantically equivalent values in different formats (e.g., '1.0' vs 1) are reported as differences

    What to do instead: Normalise number and boolean types before diffing if your data has mixed string/native representations

Related tools