jsondiff
Diff JSON and JSON-like structures in Python
What it is and what it does
jsondiff computes a semantic diff between two JSON or JSON-like structures (dicts, lists, sets) and returns a compact representation of the changes. Instead of showing raw before-and-after values, it identifies specific insertions, deletions, and updates, making it easier to understand what changed between two versions of a data structure.
The package supports multiple diff syntaxes (compact, symmetric, explicit), can exclude specific paths from comparison, handles sets with special add/discard operations, and can load/dump JSON strings directly. It includes both a Python API and a command-line tool (jdiff) for comparing JSON and YAML files. The single runtime dependency is pyyaml, used for YAML support in the CLI.
Use it for:
- Track configuration changes between versions by diffing JSON config files to see exactly what was added, removed, or modified.
- Generate minimal patches for API responses to transmit only the differences to clients rather than full payloads.
- Compare test fixtures or expected vs. actual output in test suites to identify specific assertion failures.
- Audit data migrations by diffing database exports or snapshots to verify what records changed.
- Build change logs or diffs for version control of JSON-based data (e.g., Terraform state, CloudFormation templates).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes structured diffs between JSON and JSON-like Python objects, representing changes as insertions, deletions, and updates rather than raw value replacements.
Yes. The package is lightweight, actively maintained, has no known vulnerabilities, uses a permissive MIT license, and solves a common problem cleanly. Install it if you need to understand or track changes in JSON or dict-like data structures; the low friction and stable API make it a safe dependency.
Install
jsondiff on PyPI
pip
pip install jsondiffuv
uv add jsondiffpoetry
poetry add jsondiffInstalling jsondiff
Before you install
Low install friction; pure Python wheel with a single runtime dependency (pyyaml). Repository is active with a recent commit on 2026-06-28 and has been maintained since its first release in 2015.
License in practice
MIT License permits unrestricted use, modification, and distribution with only attribution required; no restrictions on commercial or proprietary use.
Quickstart
pip install jsondiff
import jsondiff
result = jsondiff.diff({'a': 1, 'b': 2}, {'b': 3, 'c': 4})
print(result) # {'c': 4, 'b': 3, delete: ['a']}
Requires Python 3.8 or later.
Verify before relying
- Whether the package handles deeply nested structures or very large JSON documents efficiently.
- Performance characteristics when diffing complex arrays with many reordered elements.
Package facts
| License | The MIT License (MIT) Copyright (c) 2015 Zoomer Analytics LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyyaml |
| Maintenance | actively maintained — 715 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,617,310/month — #1,380 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: jsondiff-2.2.1-py3-none-any.whl
Keywords: json, diff, diffing, difference, patch, delta, dict, LCS
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
dictdifferDictdiffer computes and applies diffs and…
permissive · top 5,000 on PyPI
dmiparserParses dmidecode output into structured Python…
permissive · top 15,000 on PyPI
json-deltaComputes and applies diffs/patches between JSON…
permissive · top 15,000 on PyPI
jsoncomparisonCompares two JSON-like objects and returns a…
permissive · top 5,000 on PyPI
deepdiffDeepDiff compares dictionaries, iterables,…
permissive · top 1,000 on PyPI
fast-diff-match-patchWraps the C++ implementation of…
permissive · top 15,000 on PyPI
fastdiffFastdiff provides a fast diff algorithm…
permissive · top 15,000 on PyPI
condense-jsonCondense JSON by replacing repeated strings and…
permissive · top 15,000 on PyPI
diff-match-patchProvides diff, match, and patch algorithms for…
permissive · top 5,000 on PyPI
pyjsonCompares the similarity between two JSON files…
permissive · top 15,000 on PyPI