Agent Utilities
← JSON & data

data.json-diff · v1.0.0

JSON Diff
for your agent.

Compare JSON structures and return bounded changes at JSON Pointer paths.

$0.0005 / call500 micro-dollar credits
131,072 bytes max input65,536 bytes max output
Works on supplied inputNo external network fetch

Example input

{
  "before": {
    "price": 10
  },
  "after": {
    "price": 12,
    "inStock": true
  }
}

Example output

{
  "equal": false,
  "changes": [
    {
      "path": "/inStock",
      "kind": "added",
      "after": true
    },
    {
      "path": "/price",
      "kind": "changed",
      "before": 10,
      "after": 12
    }
  ],
  "truncated": false,
  "scope": "Structural differences at JSON Pointer paths; arrays are compared by index. This is not an executable JSON Patch."
}

Generated from the actual handler using this example input; this is a preview, not a paid API call. Paid responses wrap the result with a receipt and recovery expiry.

Call it from your agent

Add credits in the workspace and keep your API key in private environment storage. Use the same request ID and exact body to recover a lost response within ten minutes.

// Node.js 22+. Read the key from your private environment.
const requestId = Date.now() + '_' + crypto.randomUUID();
const response = await fetch('https://agent-utilities.agent-utilities.workers.dev/v1/tools/data.json-diff', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + process.env.AGENT_UTILITIES_API_KEY,
    'Idempotency-Key': requestId
  },
  body: JSON.stringify({
  "before": {
    "price": 10
  },
  "after": {
    "price": 12,
    "inStock": true
  }
})
});
const data = await response.json();
if (!response.ok) throw new Error(data.error?.message ?? 'Request failed');
console.log(data);
// On response loss, retry this SAME requestId, tool and body.
// Do not rerun the line that generates requestId for a retry.
Input JSON Schema
{
  "type": "object",
  "properties": {
    "before": {},
    "after": {},
    "maxChanges": {
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "required": [
    "before",
    "after"
  ],
  "additionalProperties": false
}
Output JSON Schema
{
  "type": "object",
  "properties": {
    "equal": {
      "type": "boolean"
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "before": {},
          "after": {}
        },
        "required": [
          "path",
          "kind"
        ],
        "additionalProperties": false
      }
    },
    "truncated": {
      "type": "boolean"
    },
    "scope": {
      "type": "string"
    }
  },
  "required": [
    "equal",
    "changes",
    "truncated",
    "scope"
  ],
  "additionalProperties": false
}

Before you integrate

Prices are experimental. The service currently allows 1,000 new calls per day across all accounts. Failed operations return reserved credits. Successful results are encrypted for ten-minute retry recovery. Review data handling and service limits.

Related tools

data $0.0005 / call

JSON Patch

Apply up to 100 RFC 6902 operations transactionally to supplied JSON, with strict pointers, safe object properties and bounded intermediate results.

data.json-patch

data $0.0003 / call

JSON Pointer

Select JSON values with up to 100 RFC 6901 pointer strings, preserving missing versus null.

data.json-pointer

data $0.0003 / call

JSON Canonical

Serialize JSON with sorted object keys for deterministic comparison; not RFC 8785 certification.

data.json-canonical