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": "alice@example.com"
}
],
"changed": [
{
"path": "/version",
"new_value": 2,
"old_value": 1
}
],
"removed": [],
"identical": false,
"added_count": 1,
"changed_count": 1,
"removed_count": 0
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
after | any | Yes | Modified JSON |
before | any | Yes | Original JSON |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
added | array | Always (present in every successful answer) |
changed | array | Always (present in every successful answer) |
removed | array | Always (present in every successful answer) |
identical | boolean | Always (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": "alice@example.com",
"version": 2
},
"before": {
"name": "Alice",
"version": 1
}
},
"max_price_cents": 3
}' {
"tool": "strale_execute",
"arguments": {
"slug": "diff-json",
"inputs": {
"after": {
"name": "Alice",
"email": "alice@example.com",
"version": 2
},
"before": {
"name": "Alice",
"version": 1
}
},
"max_price_cents": 3
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "diff-json",
inputs: {
"after": {
"name": "Alice",
"email": "alice@example.com",
"version": 2
},
"before": {
"name": "Alice",
"version": 1
}
},
max_price_cents: 3,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="diff-json",
inputs={
"after": {
"name": "Alice",
"email": "alice@example.com",
"version": 2,
},
"before": {
"name": "Alice",
"version": 1,
},
},
max_price_cents=3,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i -X POST https://api.strale.io/x402/v2/diff-json \
-H 'Content-Type: application/json' \
-d '{
"after": {
"name": "Alice",
"email": "alice@example.com",
"version": 2
},
"before": {
"name": "Alice",
"version": 1
}
}' 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
- JSON Schema Validation €0.02