Developer · Diff
JSON diff and compare.
Paste two JSON documents. Key order and whitespace are ignored; every added, removed and changed value is listed by its JSON Pointer path, with an optional RFC 6902 JSON Patch that turns the first into the second. Arrays are compared by index. Runs in your browser; nothing is uploaded.
Inputs
Differences
Paste both documents and press Compare.
Worked example
Original:
{"name":"api","port":80,"tags":["a","b","c"],"a/b":{"x~y":1},"gone":true}
Modified (keys reordered, other edits made):
{"tags":["a","z"],"name":"api","port":8080,"a/b":{"x~y":2},"new":null}
Differences, by JSON Pointer path:
changed /port 80 -> 8080 changed /tags/1 "b" -> "z" removed /tags/2 "c" changed /a~1b/x~0y 1 -> 2 removed /gone true added /new null
RFC 6902 patch that turns the original into the modified document:
[{"op":"replace","path":"/port","value":8080},
{"op":"replace","path":"/tags/1","value":"z"},
{"op":"remove","path":"/tags/2"},
{"op":"replace","path":"/a~1b/x~0y","value":2},
{"op":"remove","path":"/gone"},
{"op":"add","path":"/new","value":null}]
Moving name to a different position is not a difference, because an object is an unordered set of members. The key a/b is written a~1b and x~y is written x~0y in a pointer, as RFC 6901 requires.
How the comparison works
Objects are matched by key. A key only in the original is removed, a key only in the modified document is added, and a key in both is compared recursively. Key order never matters (RFC 8259, section 4: an object is an unordered collection).
Arrays are compared by index. Element 0 is compared with element 0, element 1 with element 1, and so on; extra elements at the end are added or removed. The tool does not try to detect that an item moved or was inserted at the front, so inserting one item at the start of a 100-item array reports every later index as changed. This matches how RFC 6902 addresses array positions, and it keeps the result predictable.
Values of different types (for example "1" against 1, or null against {}) are one changed entry at that path. Numbers are read as IEEE 754 doubles, so 1 and 1.0 are equal, and two integers above 9007199254740991 that differ only in their last digits can read as equal (RFC 8259, section 6). Whitespace between tokens is ignored. If an object repeats a key, the last one wins, as in JSON.parse.
The patch uses only add, remove and replace (RFC 6902, sections 4.1 to 4.3). Array removals are written from the highest index down so earlier indexes do not shift. The tool applies the patch to the original itself and tells you whether the result equals the modified document; if that check ever fails it says so instead of showing a patch silently.
Sources (as of 2026-10-01): RFC 8259, The JSON Data Interchange Format; RFC 6902, JSON Patch; RFC 6901, JSON Pointer.
How to compare two JSON documents
Paste the earlier version into Original JSON and the later one into Modified JSON, then press Compare. Each difference is listed with its JSON Pointer path and whether it was added, removed or changed, followed by an RFC 6902 patch. Both sides must be valid JSON: a trailing comma, single quotes or a comment is reported as an error naming the side and the position, for example “Original is not valid JSON: Expected double-quoted property name in JSON at position 7 (line 1 column 8)” for {"a":1,}.
A second example: an array with an item inserted at the front
Original: {"users":[{"id":1,"name":"Ada"},{"id":2,"name":"Lin"}],"active":true}
Modified: {"users":[{"id":0,"name":"Zed"},{"id":1,"name":"Ada"},{"id":2,"name":"Lin"}],"active":true}
A person sees one new user. Because arrays are compared by index, the tool reports 4 changed values and 1 added value:
[{"op":"replace","path":"/users/0/id","value":0},
{"op":"replace","path":"/users/0/name","value":"Zed"},
{"op":"replace","path":"/users/1/id","value":1},
{"op":"replace","path":"/users/1/name","value":"Ada"},
{"op":"add","path":"/users/2","value":{"id":2,"name":"Lin"}}]
The patch is correct: applying it to the original gives the modified document, and the tool checks that for you. It is just not minimal. If your arrays are lists of records that can be reordered, sort both by a stable key (such as id) before comparing, so the same record sits at the same index on both sides.
A third example: type changes and new keys
Comparing {"price":19.99,"qty":"3"} with {"price":19.99,"qty":3,"tags":[]} produces a replace for /qty (the string “3” became the number 3) and an add for /tags. A string and a number with the same digits are different JSON values, a mismatch that often explains an API client that suddenly fails.
What people use a JSON diff for
- API regressions: save a response before and after a deploy and look only at the fields that changed.
- Configuration drift: compare a deployed settings file with the one in version control without being fooled by key order.
- Test snapshots: find the single changed value in a large expected-output file.
- Building a patch: generate an RFC 6902 document to send with an HTTP PATCH request, using the media type
application/json-patch+json.
JSON Patch versus JSON Merge Patch
These are two different formats. JSON Patch (RFC 6902) is a list of operations, each with an op and a path; the standard operations are add, remove, replace, move, copy and test, and this tool produces only add, remove and replace. JSON Merge Patch (RFC 7396, media type application/merge-patch+json) is a partial document where a null value means “remove this member” and arrays are replaced whole. Merge Patch is simpler but cannot set a value to null or change one array element. Check which one your server accepts before sending a patch from this page.
Limits to keep in mind
The tool does not detect moved objects, does not match array items by key, and does not ignore chosen fields such as timestamps. Numbers are compared as IEEE 754 doubles, so very large integers that differ only in the last digits can compare equal. A patch that reports a change tells you what differs, not whether the difference matters.
Sources
Each source below was opened and checked in October 2026 (retrieved 2026-10).
- RFC 6902, JavaScript Object Notation (JSON) Patch: operations, application/json-patch+json, error handling
- RFC 6901, JSON Pointer: path syntax and the ~0 and ~1 escapes
- RFC 8259, The JSON Data Interchange Format: unordered objects, number handling, grammar
- RFC 7396, JSON Merge Patch: application/merge-patch+json, null deletes a member, arrays replaced whole
Frequently asked questions
Does key order matter when comparing JSON?
No. A JSON object is an unordered collection of members, so two objects with the same keys and values in a different order are equal. Order does matter inside arrays.
Why does inserting one array item flag everything after it?
Because arrays are compared by index. Item 3 in the original is compared with item 3 in the modified document, so after an insertion every later pair differs. Sort both arrays by a stable key before comparing, or use the Text Diff Checker, which matches lines with the Myers algorithm and so tolerates insertions.
What is a JSON Pointer path like /a~1b/0?
It is the address of a value (RFC 6901). Each / goes one level down, a number picks an array index, and ~1 stands for a literal / while ~0 stands for a literal ~ inside a key. An empty path means the whole document.
Can I apply the JSON Patch with other software?
Yes. It uses only add, remove and replace, which every RFC 6902 implementation supports. Operations run in order, so keep the order shown.
Is my JSON uploaded?
No. Parsing and comparing happen in your browser and nothing is stored or sent.
How do I compare two JSON files online?
Paste the first into Original JSON and the second into Modified JSON, then press Compare. The page parses both, ignores key order and white space, and lists every added, removed and changed value by path, plus a JSON Patch you can copy.
What is the difference between JSON Patch and JSON Merge Patch?
JSON Patch (RFC 6902) is a list of operations such as add, remove and replace addressed by JSON Pointer paths. JSON Merge Patch (RFC 7396) is a partial document in which null deletes a member and arrays are replaced whole. This tool outputs JSON Patch.
Why does the tool say a string and a number are different?
Because they are different JSON types. "3" is a string and 3 is a number, so the comparison reports one changed value at that path. Many bugs come from a field that silently switched type.
Can it compare arrays when the order is different?
Not directly. Arrays are compared by index, so the same items in a different order show as changes. Sort both arrays by a stable key first, or compare them with a tool built for unordered sets.
What does the "add" operation at /users/2 mean?
It inserts a value at index 2 of the users array. In RFC 6902, the path for add on an array points at the position where the new element goes; the special last segment "-" appends to the end of the array.
Does the patch apply atomically?
RFC 6902 says evaluation stops at the first operation that fails and the patch is not successful, and that HTTP PATCH is atomic, so no partial change is kept. This tool also applies the patch to your original itself and tells you whether the result equals the modified document.
Data comparison only
This tool compares structure and values. It does not know what your fields mean, so a change it lists may be harmless or important to your application. Very large inputs may be slow on a phone.