What This Tool Does
JSON Diff compares Original (A) with Modified (B). It reports added, removed, and changed values by JSON path, then shows them in a highlighted code diff or as JSON Patch-style operations.
Paste or upload two JSON documents and the tool parses each with the browser's JSON parser, then walks both structures together - object by object, array by array, value by value - and reports every place they differ. Each difference is reported by its JSON path, along with the old value, the new value, or both.
Compare Two JSON Documents
Paste JSON into Original (A) and Modified (B), or drop or browse for JSON or TXT files. The tool parses both inputs with JSON.parse and reports a parse error with the document name and, where available, line and column details.
Before comparing, choose an array mode and a path format. The comparison updates automatically when both documents and settings are usable. Click Clear to remove both inputs and hide that workspace.
Choose Array Matching
- By position - index 0 is compared to index 0, index 1 to index 1, and so on. Inserting or removing an item in the middle of an array shifts every later index and can make those entries appear changed.
- By key field - enter a field name in Array key field name. When every element in both arrays is an object containing that field, elements are matched by its
String()value. The field should identify each element uniquely. Duplicate or colliding values overwrite earlier entries internally and are not validated. Arrays that are not uniformly keyable fall back to position-based comparison.
Object keys are matched by name, not position, so changing the order of keys within an object does not create a difference.
Choose Path Style and Read the Results
Choose Dot notation ($.a.b[0]) or JSON Pointer (/a/b/0) under Path style. The selected style changes paths shown in the tree and report.
- Diff view shows removed values with a minus marker and added values with a plus marker; each block includes its JSON path.
- JSON Patch shows the differences as
add,remove, andreplaceoperations. It always uses JSON Pointer paths, regardless of the selected path style.
Use Export diff report to download a JSON report, or Export patch to download the patch output. An added or removed entry may omit the other value field in the serialized report.
How to Use JSON Diff
- Paste or drop/browse for your JSON or TXT files in Original (A) and Modified (B).
- Choose By position or By key field. If you choose key matching, enter the field in Array key field name.
- Choose Dot notation ($.a.b[0]) or JSON Pointer (/a/b/0) under Path style.
- Review the comparison as it updates, then choose Diff view or JSON Patch exports.
- Use Export diff report or Export patch when you need a JSON download.
Understand the JSON Patch-Style Output
The patch is an RFC 6902-style representation of the comparison: a list of add, remove, and replace operations with JSON Pointer paths. The tool derives these operations directly from the comparison entries. Inspect, validate, or reorder them before applying them downstream, especially for arrays; the implementation does not guarantee a safe operation order or valid indexes after earlier operations.
Limitations and Browser Processing
JSON Diff reports structural differences between two JSON documents only. It does not flatten a single JSON document into flat key-value rows - use Flatten JSON for that - and it does not compare CSV or other tabular rows - use CSV Diff for that. It also does not validate a single document in isolation - use JSON Validator if you just need to check that one document is syntactically valid JSON.
In the inspected tool script, parsing uses JSON.parse, uploads are read with FileReader, and downloads are created with browser APIs. That script contains no network request. This implementation does not establish account policies or service-wide usage limits.
Frequently Asked Questions
How is this different from Flatten JSON or JSON Validator?
This tool reports structural differences between two JSON documents - added, removed, and changed values by path. Flatten JSON converts a single document into flat key-value rows without comparing it to anything. JSON Validator checks that a single document is syntactically valid JSON. Use JSON Diff when you have two JSON documents and want to know what changed between them.
Does key order matter?
No. Object keys are matched by name, not position, so reordering keys within an object never registers as a change.
How are arrays compared?
By default, arrays are compared by position - index 0 to index 0, index 1 to index 1, and so on. For object arrays, choose By key field and enter Array key field name to match elements by the field's String() value. Every element in both arrays must contain that field. Duplicate or colliding values are not validated, and non-uniformly keyable arrays fall back to position-based comparison.
What is the JSON Patch-style result?
It is an RFC 6902-style list of add, remove, and replace operations with JSON Pointer paths. It is not guaranteed to be directly applicable: inspect, validate, or reorder the operations before applying them downstream, especially when arrays are involved.