Skip to main content

quick-json-diff

Python License PyPI version PyPI downloads

A fast JSON diff tool built entirely with the Python standard library — no third-party dependencies required.

Recursively compare two JSON objects and produce a structured list of all differences (added, removed, or modified values), each annotated with a clear dot-notation path.


Features

  • Zero dependencies — powered by Python standard library only
  • Recursive comparison — drill into nested dicts and lists automatically
  • Clear path output — each difference includes a dot-notation / bracket-notation path (e.g., variables[3].spec.sort)
  • Three diff kinds — added, removed, modified for every change
  • CLI + Python API — use it from the command line or as a library
  • Safe & predictable — pure Python dataclass output, easy to serialise

Installation

python -m pip install quick-json-diff

Usage

CLI

json-diff <left_json_file> <right_json_file>

Example:

json-diff test_left.json test_right.json

Output:

[
    {
        "path": "variables[3].spec.sort",
        "kind": "modified",
        "left": "alphabeticalAsc123",
        "right": "alphabeticalAsc"
    }
]

Python API

import json
from quick_json_diff import JsonDiffer

left = JsonDiffer.read_json("test_left.json")
right = JsonDiffer.read_json("test_right.json")
differ = JsonDiffer(left, right)
result = differ.diff()

print(json.dumps(result, ensure_ascii=False, indent=2))

You can also work with raw Python objects directly:

from quick_json_diff import JsonDiffer

left = {"a": 1, "b": [1, 2, 3]}
right = {"a": 2, "b": [1, 2, 3, 4], "c": "new"}
differ = JsonDiffer(left, right)
result = differ.diff()

for item in result:
    print(f"{item['kind']}: {item['path']}")
    if item['left'] is not None:
        print(f"  left:  {item['left']}")
    if item['right'] is not None:
        print(f"  right: {item['right']}")

Output:

modified: a
  left:  1
  right: 2
added: c
  right: new
added: b[3]
  right: 4

Output Format

differ.diff() returns a list[dict]. Each dict has the following keys:

Key Type Description
path str Dot/bracket-notation path to the value
kind "added" / "removed" / "modified" Type of change
left Any (optional) Original value (present for removed / modified)
right Any (optional) New value (present for added / modified)

The same shape is available as the DiffResult dataclass:

from quick_json_diff import DiffResult

result: DiffResult  # .path, .kind, .left, .right

Contributing

Contributions are welcome! Here's how you can help:

  1. Report issues — open a GitHub Issue for bugs or feature requests
  2. Submit pull requests — fork the repo, make changes, and open a PR
  3. Development setup:
    git clone https://github.com/rainuxhe/fastjsondiff.git
    cd quick-json-diff
    pip install -e ".[dev]"
    python -m build
    

Before submitting, please ensure the existing tests pass and add tests for new functionality.


License

MIT © 2026 Rainux He

Metadata

Release files for quick-json-diff 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quick-json-diff 1.0.0
File Size Uploaded
quick_json_diff-1.0.0.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quick-json-diff 1.0.0
File Interpreter ABI Platform
quick_json_diff-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / quick_json_diff-1.0.0.tar.gz

Download URL quick_json_diff-1.0.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1d7592b18f4e1ab76ff560c8f3c569185f1c0b0e14c065f770a66c2cc77bcf7
BLAKE2b-256 checksum
How to use checksums
fe500baccaa16d9af384164e0e1e57fd890927f10f9401e13e53f798e6830541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / quick_json_diff-1.0.0-py3-none-any.whl

Download URL quick_json_diff-1.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e77ed82cec8f1a39d802ca3b65b81b65a7a62b6767d40b8647cbb4bbc0690a9e
BLAKE2b-256 checksum
How to use checksums
780f82a1893b355980fe2599e275edbb21e658b9b7a1f9aafa85acbd5e9ac203
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page