Skip to main content

A minimal, zero-dependency library for comparing JSON objects with human-readable output

Project description

json-diff-lite

A minimal, zero-dependency Python library for comparing JSON objects with human-readable output.

Why?

Existing JSON diff libraries have their drawbacks:

Library Issue
deepdiff Powerful but heavy, complex output
jsondiff Unintuitive API, hard to interpret results
dictdiffer Output as technical tuples, not human-friendly
difflib Operates on strings, not structured JSON

json-diff-lite is designed to be:

  • Zero dependencies
  • Minimal API
  • Human-readable output
  • Perfect for logs, debugging, and CI

Installation

pip install json-diff-lite

Usage

from json_diff_lite import diff

old = {
    "name": "Ana",
    "age": 30,
    "address": {"street": "Rua A", "number": 100}
}

new = {
    "name": "Ana Maria",
    "age": 31,
    "address": {"street": "Rua B", "number": 100}
}

changes = diff(old, new)
for change in changes:
    print(change)

Output:

~ address.street: 'Rua A' -> 'Rua B'
~ age: 30 -> 31
~ name: 'Ana' -> 'Ana Maria'

Output format

  • + key: value — Added
  • - key: value — Removed
  • ~ key: old -> new — Modified

Supported types

  • Dicts (recursive)
  • Lists (index-based comparison)
  • Primitives: str, int, float, bool, None

Limitations

Current version (v0.1.0) does not support:

  • Smart list matching (by similarity or ID)
  • Custom objects
  • Colored output
  • Unordered comparison tolerance

These features are planned for future releases.

Development

# Clone the repository
git clone https://github.com/nilerbarcelos/json-diff-lite.git
cd json-diff-lite

# Install dev dependencies
pip install hatch

# Run tests
hatch run test:run

Roadmap

v0.1.0 — MVP (current)

  • Basic diff for dict/list/primitives
  • Human-readable output
  • Tests

v0.2.0 — CLI

json-diff-lite file1.json file2.json

v0.3.0 — Colored output

  • ANSI colors (optional)

v0.4.0 — Smart list diffing

  • Match list items by similarity

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

json_diff_lite-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

json_diff_lite-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file json_diff_lite-0.1.0.tar.gz.

File metadata

  • Download URL: json_diff_lite-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for json_diff_lite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77a9b738f30c7a3f673289771ea6153b9aca2884881cb1785dacb197b8ddd54e
MD5 a41f51e1c6eb66001871beea83bedd32
BLAKE2b-256 82669023266441363f7af7c74916e74ea69964f1140374f2e849ead39620a4ba

See more details on using hashes here.

File details

Details for the file json_diff_lite-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: json_diff_lite-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for json_diff_lite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01ca2a2fd2994bbd884fbdf05dbcc09b96143ce287e61bcb31257e84ed0c86a8
MD5 3aebb136fba7947cd7eadc107435ab4b
BLAKE2b-256 9bbbef5c39a3cf856fbfb436173d79b7a0a9f1ca7fa76b15ce64484ba9649206

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page