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 ❤️

Note: Version 1.0.0 is the final stable release. No further development is planned.

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

Options

Flag Description
-o, --output Path to the output HTML file. When omitted, HTML is printed to stdout.
--open Open the generated HTML report in the default browser (requires -o).
-q, --quiet Suppress all output except errors.
--no-style Generate HTML without CSS styles (lighter output).
--version Show program version and exit.

Exit codes

  • 0: no differences were detected (an HTML report is still generated showing "No differences").
  • 1: differences were found and the HTML describes every change.
  • 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-1.0.0.tar.gz (17.0 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-1.0.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for json_pretty_diff-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1618265334c8cd0f3e8e56773109bda4d4df1c840de313d08dab698a56e72b31
MD5 3fc5939834eb13c10b9537f3f2b7cd7b
BLAKE2b-256 b616d5c09d5e374b35adeff7f05af1b0a884ad5b56f58b806e46a676f01012b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for json_pretty_diff-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6fef5c93bebc72004b36a95df81d182c83d4e286d6bb20683c967cbe020ffc7
MD5 5dd590afb73de50ac04d49a12217d085
BLAKE2b-256 d5eba9df9acc57a790ae1441389c6bb81d7f4b8edf8f45d14365ba5c9bc1314e

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