Original JSON
Modified JSON
Add JSON to both sides and click Compare

JSON Diff Tool Online

What is JSON Diff?

A JSON Diff tool is a utility that compares two JSON documents side by side and identifies the differences between them. It highlights added lines in green, removed lines in red, and shows unchanged lines without highlighting. A JSON comparison tool is essential for developers who need to understand what changed between two versions of a JSON file — whether it's an API response, a configuration file, or a data export.

With a JSON diff checker, you can quickly spot what was added, removed, or modified between two JSON documents. This JSON compare tool normalizes both inputs by parsing and reformatting them, ensuring that differences in whitespace or formatting don't produce false positives. The result is a clean, accurate diff that shows only the meaningful changes between your JSON files.

When to Use JSON Diff

API Changes: When an API response format changes between versions, use a JSON diff comparison to see exactly which fields were added, removed, or renamed. This helps API consumers update their integration code to match the new response structure.

Configuration Updates: JSON configuration files like package.json, tsconfig.json, or Docker Compose files evolve over time. A JSON file comparison makes it easy to review configuration changes before deploying them to production.

Data Migration: When migrating data between systems, comparing the source and destination JSON formats ensures that no data is lost or misaligned. Use this JSON diff tool online to validate that your data transformation is correct.

Code Review: When reviewing pull requests that modify JSON fixtures, mock data, or test payloads, a JSON side-by-side diff helps reviewers quickly understand the scope and impact of the changes.

How to Compare JSON Files

Follow these simple steps to compare two JSON files using PrettyJSONView's JSON Diff Tool:

  1. Enter Original JSON: Paste or upload the original JSON into the left editor. You can also type directly into the editor.
  2. Enter Modified JSON: Paste or upload the modified JSON into the right editor.
  3. Click Compare: Press the Compare button to compute the difference between the two JSON documents.
  4. Review Results: The diff results panel shows each line with green for additions, red for removals, and neutral for unchanged lines. Statistics show the total number of additions, removals, and unchanged lines.
  5. Swap if Needed: Use the Swap button to exchange the contents of the two editors and re-compare.

Features of PrettyJSONView JSON Diff Tool

Side-by-Side Editors: Two independent CodeMirror editors side by side on desktop, stacked on mobile. Each editor supports syntax highlighting, line numbers, and full JSON editing capabilities.

Accurate Diff Algorithm: Uses a Longest Common Subsequence (LCS) algorithm to compute precise diffs. Both inputs are normalized before comparison, so whitespace and formatting differences don't create false positives.

Color-Coded Results: Added lines are highlighted in green with a prefix, removed lines in red with a prefix, and unchanged lines are displayed neutrally. Statistics show the count of each at a glance.

File Upload Support: Upload JSON files directly from your computer into either editor. Supports large files and deeply nested JSON structures.

Convenience Tools: Swap the contents of the two editors with one click. Copy the content of either editor to your clipboard. Clear both editors and start fresh.

Privacy-Friendly Local Processing: All JSON comparison happens entirely in your browser. Your data never leaves your device — no uploads to servers, no tracking, no storage. This is a core principle of the PrettyJSONView JSON diff comparison tool.

More JSON Tools

Frequently Asked Questions

What is a JSON Diff Tool?
A JSON Diff Tool is a utility that compares two JSON documents and identifies all differences between them. It shows added lines in green, removed lines in red, and unchanged lines without highlighting. This helps developers quickly understand what changed between two versions of a JSON file, whether it's an API response, configuration file, or data export.
How do I compare two JSON files?
To compare two JSON files using PrettyJSONView's JSON Diff Tool, paste or upload your original JSON into the left editor and your modified JSON into the right editor. Click the "Compare" button to compute the differences. The results panel will show each line with color-coded highlighting — green for additions, red for removals, and neutral for unchanged lines.
Does the diff ignore whitespace and formatting?
Yes. The JSON Diff Tool normalizes both inputs by parsing them with JSON.parse() and then reformatting them with consistent indentation using JSON.stringify(val, null, 2). This ensures that differences in whitespace, indentation, or formatting between the two files do not produce false positives in the diff results.
What algorithm does the diff use?
The JSON Diff Tool uses a Longest Common Subsequence (LCS) algorithm to compute the difference between two JSON documents line by line. The LCS algorithm finds the longest sequence of lines that appear in both documents in the same order, then backtracks to identify which lines were added, removed, or unchanged. This provides accurate, deterministic diff results.
Can I paste JSON into the editors?
Yes, you can paste JSON directly into either editor. You can also use the "Paste Left" and "Paste Right" buttons in the header to open a modal with a larger textarea for pasting. Additionally, you can type directly into the CodeMirror editors or drag and drop JSON files onto them.
Can I upload JSON files for comparison?
Yes. Click "Upload Left" or "Upload Right" to select a .json file from your computer to load into the corresponding editor. The tool supports large JSON files and processes them efficiently without freezing the browser.
Is this JSON Diff Tool free?
Yes, this JSON Diff Tool is completely free to use. There are no paywalls, no subscription plans, and no hidden fees. All features including side-by-side editors, comparison, swap, copy, and upload are available at no cost. It will remain free.
Does the comparison happen locally?
Yes, all JSON comparison happens entirely in your browser using client-side JavaScript. Your data never leaves your device. There are no server requests, no data uploads, and no external API calls. This ensures your JSON data remains completely private and secure.
What happens if my JSON is invalid?
If either JSON document is invalid, the tool will show an error message indicating which side has the invalid JSON and the specific parse error. You need both sides to contain valid JSON for the comparison to work. Use the JSON Validator tool to check and fix any JSON syntax issues before comparing.
Can I swap the left and right editors?
Yes. Click the "Swap" button to exchange the contents of the left and right editors. This is useful if you accidentally placed the original and modified JSON in the wrong editors, or if you want to compare the documents in reverse order. The swap happens instantly, and you can re-compare after swapping.