{"slug":"json-diff-paths","name":"JSON Diff Paths","version":"1.0.0","updated_at":"2026-10-09T02:36:12.917Z","use_when":"Compares two pasted JSON documents, BEFORE and AFTER, and lists every value that differs as strict JSON, one entry per changed path, with the old and the new value. Paths are JSON Pointers, types are strict (the string \"1\" is not the number 1, null is not a missing key, an empty array is not an empty object), arrays are compared by index with no move detection, object key order and number spelling (1.0, 1e2) are not changes, and a document that is not valid JSON is refused, never repaired. Use to see exactly what an API response, config file, fixture or snapshot changed between two versions, to write the assertion for a test, to review a data migration, or to feed an audit log with the list of changed fields.","not_for":"Producing a patch that turns one document into the other (no move or copy operations, no RFC 6902 output), judging whether a change is good, or comparing the documents with the outside world. It reads two pasted JSON documents at a time and refuses text that is not valid JSON instead of repairing it.","languages":["en","bg","es","de"],"tags":["json","diff","compare","json-pointer","snapshots","audit"],"category":"data","category_url":"https://aiskills402.com/categories/data","keywords":["pasted json documents","audit log","api response"],"faq":[{"q":"Reordered arrays, or an item inserted at the front: what comes back?","a":"By index, with no move detection. Putting a new item at the front changes every position after it and adds one at the end, and the list says exactly that, so it matches what a position-based assertion in a test will see."},{"q":"What happens when one document has a trailing comma, a comment or is cut off?","a":"It refuses with one line that names the document and the first fault. It does not strip the comment or fix the comma, because any repair would invent changes that are not in the text."},{"q":"Is the string 1 the same as the number 1, and null the same as a missing key?","a":"No to both. The string 1 and the number 1 are a change of type, null against zero or against an empty string is a change, and a key that holds null is a value that a missing key does not have, so adding or dropping it is a separate entry."},{"q":"Does it help Claude Sonnet?","a":"A cent is the price because we measured no gain. Both Claude models compared twenty-four pairs of documents, guided by the file and then cold, and a script checked every entry against a diff computed by code. Our request already spelled out the shape, the pointer paths and the type rules, and with that both models got all 24 right unaided. What the file adds is a fixed refusal line, CANNOT DIFF, that a program can catch: Haiku once refused in a plain sentence instead. We did not test a shorter request."}],"examples":[{"lang":"en","model":"claude-sonnet-5-5","input_excerpt":"BEFORE:\n{\n  \"id\": \"7\",\n  \"qty\": 3,\n  \"active\": true,\n  \"note\": null,\n  \"price\": 9.5,\n  \"sku\": \"A-100\"\n}\n\nAFTER:\n{\n  \"id\": 7,\n  \"qty\": \"3\",\n  \"active\": \"true\",\n  \"note\": 0,\n  \"price\": 9.50,\n  \"sku\": \"A-100\"\n}","output_excerpt":"{\"changes\": [{\"path\": \"/id\", \"op\": \"changed\", \"old\": \"7\", \"new\": 7}, {\"path\": \"/qty\", \"op\": \"changed\", \"old\": 3, \"new\": \"3\"}, {\"path\": \"/active\", \"op\": \"changed\", \"old\": true, \"new\": \"true\"}, {\"path\": \"/note\", \"op\": \"changed\", \"old\": null, \"new\": 0}]}"},{"lang":"bg","model":"claude-sonnet-5-5","input_excerpt":"BEFORE:\n{\"град\": \"\\u0421\\u043e\\u0444\\u0438\\u044f\", \"население\": 1200000, \"райони\": [\"Витоша\", \"Лозенец\"], \"ръководител\": \"Иван Петров\"}\n\nAFTER:\n{\"град\": \"София\", \"население\": \"1200000\", \"райони\": [\"Витоша\", \"Лозенец\", \"Младост\"], \"ръководител\": \"Мария Колева\", \"столица\": true}","output_excerpt":"{\"changes\": [{\"path\": \"/население\", \"op\": \"changed\", \"old\": 1200000, \"new\": \"1200000\"}, {\"path\": \"/райони/2\", \"op\": \"added\", \"new\": \"Младост\"}, {\"path\": \"/ръководител\", \"op\": \"changed\", \"old\": \"Иван Петров\", \"new\": \"Мария Колева\"}, {\"path\": \"/столица\", \"op\": \"added\", \"new\": true}]}"},{"lang":"es","model":"claude-sonnet-5-5","input_excerpt":"BEFORE:\n{\"ciudad\": \"Madrid\", \"calle\": \"Calle Mayor \", \"codigo\": \"28013\", \"pais\": \"españa\"}\n\nAFTER:\n{\"ciudad\": \"Madrid\", \"calle\": \"Calle Mayor\", \"codigo\": \"28013\", \"pais\": \"España\", \"tel\": \"+34 600 000 000\"}","output_excerpt":"{\"changes\": [{\"path\": \"/calle\", \"op\": \"changed\", \"old\": \"Calle Mayor \", \"new\": \"Calle Mayor\"}, {\"path\": \"/pais\", \"op\": \"changed\", \"old\": \"españa\", \"new\": \"España\"}, {\"path\": \"/tel\", \"op\": \"added\", \"new\": \"+34 600 000 000\"}]}"},{"lang":"de","model":"claude-sonnet-5-5","input_excerpt":"BEFORE:\n{\n  \"bestellung\": {\n    \"nr\": \"2026-114\",\n    \"positionen\": [\n      {\"artikel\": \"Stuhl\", \"menge\": 2, \"preis\": 45.0},\n      {\"artikel\": \"Tisch\", \"menge\": 1, \"preis\": 120}\n    ],\n    \"versand\": {\"art\": \"Paket\", \"frei\": false}\n  },\n  \"kunde\": \"Müller\"\n}\n\nAFTER:…","output_excerpt":"{\"changes\": [{\"path\": \"/bestellung/positionen/0/menge\", \"op\": \"changed\", \"old\": 2, \"new\": 3}, {\"path\": \"/bestellung/positionen/1/preis\", \"op\": \"changed\", \"old\": 120, \"new\": 119.99}, {\"path\": \"/bestellung/versand/frei\", \"op\": \"changed\", \"old\": false, \"new\": true}]}"}],"page_url":"https://aiskills402.com/skills/json-diff-paths","markdown_url":"https://aiskills402.com/skills/json-diff-paths.md","image_url":"https://cdn.aiskills402.com/og/skills/json-diff-paths/755161ea.png","related_url":"https://api.aiskills402.com/v1/skills/json-diff-paths/related","purchases_count":null,"tested":{"date":"2026-10-09","strong":{"model":"claude-sonnet-5-5 (Claude Code alias \"sonnet\")","verdict":"Right on all 24 pairs, checked by code against a diff computed by our script: \"1\" kept apart from 1 and null apart from a missing key, 1.0 against 1 and a new key order not reported, keys with a slash, a tilde or an empty name escaped in the pointer, a whole added object as one entry, arrays compared by position, a sentence planted in a value treated as data, and both broken documents refused with the CANNOT DIFF line."},"weak":{"model":"claude-haiku-5-5 (Claude Code alias \"haiku\")","verdict":"Right on 23 of 24 pairs, checked by code. Every diff was exact; on the document cut off in the middle of a key it refused correctly, but in a plain sentence without the CANNOT DIFF line a program looks for."},"note":"Twenty-four pairs of JSON documents written by us, in English, Bulgarian, Spanish and German: 15 with a difference built around a trap (strict types, null against a missing key, shifted, swapped and shortened arrays, a container whose type changes, pointer escapes, number spellings, a changed root, a planted sentence and a large nested document), 2 with an invalid document and 7 controls with no real difference. Every expected entry is computed from the parsed documents by a small diff function, never by hand, and each answer is parsed and compared as a set, so the order of entries and of keys is free. The shared request states the output shape, the pointer format and the type rules; it does not mention null, key order, escapes or the planted sentence. No check was widened. One run per model and pair.","baseline":{"date":"2026-10-09","rows":[{"label":"Pairs diffed right (24 pairs)","better":"higher","strong":{"with":{"n":24,"of":24},"without":{"n":24,"of":24}},"weak":{"with":{"n":24,"of":24},"without":{"n":24,"of":24}}}],"note":"Same request on both sides. On the two broken documents both sides are scored on any clear refusal with no diff, so the missing CANNOT DIFF line of Haiku is not counted here. Our request already spelled out the shape, the pointer paths and the type rules, and with that both models got every pair right without the skill; the skill adds no measured gain on this set. We did not test a shorter request."},"report_url":null},"price_usd":"0.01","price_micro":10000,"size_bytes":7468,"sha256":"dde5247d31b23074ef59368a55768fab5ad3fcb9c117bc16e3f377e5d696d226","outline":["The answer","Paths","What counts as a difference","When you must refuse","What is not your job","Work in this order","Short examples"],"license":{"summary":"Perpetual, non-exclusive; use and modify for yourself incl. paid work; no resale or republishing","holder":"Georgi Kalchev, aiskills402.com","url":"https://aiskills402.com/docs#license"},"buy_url":"https://api.aiskills402.com/v1/skills/json-diff-paths/file","redownload_url_template":"https://api.aiskills402.com/v1/purchases/{token}","mcp_tool":null,"payment":{"protocol":"x402","scheme":"exact","asset":"USDC","selling":true,"network":"base","network_caip2":"eip155:8453","pay_to":"0x8e37022edcf0f21cf3c9f93fee9d4d32519f36f4","facilitator":"cdp"},"seo_title":"List Changed Paths Between Two JSON Files","seo_description":"Two JSON documents in, every changed path out as strict JSON with old and new values; types strict, arrays by index. Pay $0.01 once, in USDC.","versions":[{"version":"1.0.0","date":"2026-10-09","changelog":"# Changelog\n\n## 1.0.0 — 2026-10-08\n\nFirst release: compares two pasted JSON documents (BEFORE and AFTER) and lists every differing value as strict JSON, one entry per path (JSON Pointer), with kinds added, removed and changed and the old and new values copied with their types. Types are strict, null is not a missing key, arrays go by index with no move detection, an added or removed value is one entry, a changed type is one entry, key order and number or escape spelling are not changes, and a document that is not valid JSON is refused with a CANNOT DIFF line. Written from the § 1 row of the batch 4 plan (the writer brief for this slug had not been appended yet). Expected entries in the tests are computed by a small diff function (test/diff.mjs), never by hand, and the check compares the set of entries in any order. No model run yet: the baseline, the price check and the sentence on what Sonnet gains are still to be written; the price 30000 is a placeholder.\n\n## 1.0.1 — 2026-10-09 (finalised after the model test)\n\n- Measured on 24 pairs: Sonnet 24 -> 24, Haiku 24 -> 24 (without -> with the skill; refusals scored on any clear refusal on both sides). With the skill Haiku refused one broken document without the CANNOT DIFF line. No check was widened.\n- Price: $0.01 (no measured gain).\n"}]}