Skip to main content

HTML-only diff generator for top-level JSON objects

Project description

json-pretty-diff

LinkedIn GitHub Buy Me a Coffee

Made with love by Javier Lianes García in Aranjuez ❤️

Overview

Generate a clean HTML report that summarizes the top-level differences between two JSON files. The report groups keys into Added, Removed, and Changed sections to make the impact of the updates easy to scan.

Installation

From PyPI (recommended)

  1. Ensure Python 3.9 or newer is available on your system.
  2. Install the package:
    pip install json-pretty-diff
    
  3. Run the CLI to compare two JSON files:
    jpd original.json updated.json -o diff.html
    
  4. Open diff.html in your browser to explore the report.

From source

  1. Clone this repository.
  2. Install the package in editable mode:
    pip install -e .
    

Usage

Run the command-line tool and point it to the files you want to compare:

jpd A.json B.json -o diff.html
  • When -o is omitted, the HTML is printed to stdout and can be redirected with >.
  • Exit code 0: no differences were detected (an HTML report is still generated showing "No differences").
  • Exit code 1: differences were found and the HTML describes every change.
  • Exit code 2: an error occurred (missing file, invalid JSON, or a root element that is not a JSON object) and no HTML report is produced.

Example

jpd fixtures/base.json fixtures/update.json -o reports/diff.html

The file diff.html will contain one section per change category with simple styles that highlight added, removed, or modified keys.

Limitations

  • Only the first-level keys are compared (no recursive diff).
  • There are no exclusions, tolerances, or advanced configuration flags.
  • Console output never uses ANSI colors.
  • There is no CI/CD integration or bundled automated test suite.

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_pretty_diff-0.1.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

json_pretty_diff-0.1.2-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file json_pretty_diff-0.1.2.tar.gz.

File metadata

  • Download URL: json_pretty_diff-0.1.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for json_pretty_diff-0.1.2.tar.gz
Algorithm Hash digest
SHA256 913114020fcabad7b0544c992cc827c75d990676acfcf33e0fe2f540ecc68218
MD5 8996cef7a61b049f773c33f40b48cc5d
BLAKE2b-256 dd7b447936550abde343634979eaccf032720135cdc50850628aa2cd67cb3fa3

See more details on using hashes here.

File details

Details for the file json_pretty_diff-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for json_pretty_diff-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e704167e396331f7665c8f4b1b46fbeccbd304d8a9b0172aebfdffdd10e3f207
MD5 92c10a459672a2a4268f8a430d42b4ae
BLAKE2b-256 b4d2ddf9fb7436cc1c84bceb37c5a42fbf19d74eca0589e462386f42f6a1809e

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