JSON Diff: Compare Two JSON Documents
Compare two JSON documents and see what changed: lines added, lines removed, and values that differ. The comparison runs in the Prettify editor, in your browser. Paste your first document in the box below to format it, then open it in the editor to compare it with a second one.
What the JSON diff does
A JSON diff shows what changed between two versions of a document. Use it to check what a config edit did, how an API response differs from yesterday, or what a teammate removed from a file.
In Prettify, the open document is the first side, labeled Current. You paste the second side, labeled Pasted. Prettify parses the pasted text as JSON. If it does not parse, you see the error and no comparison runs.
Diff / Compare is a Pro feature. Free users get one free try per day. The box at the top of this page does not compare two documents. It formats one, so you can check it before you compare.
Key features
Prettify has two diff modes, Text and Semantic. You switch between them with the Text and Semantic buttons at the top of the result. Text mode works for every format. Semantic mode is available for JSON and YAML.
- Text mode compares line by line, in a Split layout (side by side) or a Unified one (one column). It highlights the changed words inside each line.
- Semantic mode compares the parsed data and lists each change by its path, marked added, removed, or changed, with the old and new value.
- Semantic mode ignores key order, so an object with its keys reordered shows no change.
- Text mode formats both sides first, so a minified document and a pretty-printed copy of it do not show every line as changed.
- Semantic mode can copy its changes as a JSON Patch (RFC 6902), or download them as diff.patch.json.
- Large integers, like Snowflake IDs, compare by their exact digits, so two IDs that differ in the last digit show as a change.
- Press Alt+Down or n for the next change and Alt+Up or p for the previous one. The header shows your place, such as 2 of 7.
How to use it
Start with the box on this page, then finish in the editor. The box runs in your browser and takes documents up to 512 KB. Larger documents go straight to the editor.
- Paste your first JSON document into the box at the top of this page, or select Try an example.
- Check the result panel. It shows the formatted JSON, or the line and column of a syntax error.
- Select Open in full editor. The button reads Fix it in the editor when the JSON has an error.
- In the editor, click Diff / Compare in the toolbar, under the Transform group.
- Paste the second JSON document into the dialog.
- Press Cmd+Enter (Mac) or Ctrl+Enter (Windows, Linux), or click Compare.
- Choose Text or Semantic at the top of the result, then step through the changes.
Worked example
Say a service config changed between two releases. The first document is open in the editor, and you paste the second into Diff / Compare. The second lists its keys in a different order, adds a region, and drops the owner key.
In Semantic mode, the change list reads as follows. Each line shows the type of change, the path, and the old and new value.
Current
{
"name": "orders-api",
"version": "1.4.0",
"replicas": 2,
"regions": ["us-east", "eu-west"],
"debug": true,
"owner": "platform"
}
Pasted
{
"debug": false,
"name": "orders-api",
"version": "1.5.0",
"replicas": 3,
"regions": ["us-east", "eu-west", "ap-south"],
"timeout": 30
}
Semantic diff
changed version 1.4.0 → 1.5.0
changed replicas 2 → 3
added regions[2] ap-south
changed debug true → false
removed owner platform
added timeout 30Reading the result
Semantic mode finds six changes. The name key moved position in the Pasted document, and it still shows no change, because key order does not matter here. The new region is one addition at regions[2], not a change to the whole array.
Text mode on the same pair also marks the debug line as moved, because it compares lines and does not sort keys. Copy as JSON Patch gives six operations: three replace, two add, and one remove.
Common use cases
A diff is most useful when you edit JSON by hand or receive it from a system you do not control. These are the jobs people bring to it most often, from code review to debugging.
- Review a config change, such as package.json or a feature flag file, before you deploy it.
- Compare an API response today with a saved response from before a release.
- Check that a script or migration changed only the fields you meant to change.
- Compare two test fixtures to see why one test passes and the other fails.
- Produce a JSON Patch that turns one document into the other.
Free and Pro
Formatting, the Tree, Raw, and Table views, search, and format conversion are free. Diff / Compare is a Pro feature. Free users get one free try per day: open Diff / Compare and select Try it free today. The try lasts until the end of your local day.
Pro costs US$19.99, paid once, with lifetime access and no subscription. Split view, also Pro, keeps two documents open side by side for reading or editing.
Frequently asked questions
Is the JSON diff free?
Not fully. Diff / Compare is a Pro feature in Prettify, and free users get one free try per day. Pro is US$19.99, paid once, with lifetime access and no subscription.
Does key order matter in a JSON diff?
In Semantic mode, no. A reordered object shows no change. In Text mode, yes: a key that moves shows as a removed line and an added line, because that mode compares lines.
Can I compare JSON with YAML?
Not directly. Prettify parses the pasted text with the format of the open document, so YAML pasted into a JSON document usually shows a parse error. Use Convert in the toolbar to change one side first.
Is my JSON uploaded when I compare it?
No. Parsing and comparing run in your browser. Prettify uploads a document only if you create a Pro short share link.
Can I compare formats other than JSON?
Yes. Text diff works for every format. Semantic diff, with its path list and JSON Patch export, is available for JSON and YAML only.
Can I compare two saved versions of the same document?
Yes, with Pro. History keeps up to 50 versions per document. Expand a document in History, select two versions, and select Compare Versions. Free keeps one version per document.