skillfed

jsondiff

Diff JSON and JSON-like structures in Python

jsondiff v2.2.1 11.6M downloads/30d#1,380 on PyPI748
Permissive 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) Active released

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 jsondiff

uv

uv add jsondiff

poetry

poetry add jsondiff

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

json diff librarycompare json objectsjson change detectionstructured diff tooljson patch generationfind differences between dictsjson delta
json-processingtesting-toolsdata-comparison

More Quality Assurance packages