Skip to main content

Generates differences between two json files on the console in a colored and columnar manner.

Motivation

To find difference between two long json files on the cli itself, instead of downloading files and copy pasting on some website to find the difference. Helpful when comparing production env data with the admin dashboard data during the debugging process.

Installation

pip install json-diff-cli

Quickstart

  • if a key appears in first file but not in second file OR the key appears in second file but not in first file, color of the key changes to red

  • if a value of a specific key is different in both the files, color of that key-value pair changes to green:

Combination of above 2 example

[Example]

Caveats

>>> jdif
usage: jdif [-h] jsonFilePath1 jsonFilePath2
jdif: error: the following arguments are required: jsonFilePath1, jsonFilePath2
Arguments absent: please specify file paths as shown in the example below:
jdif example_1.json example_2.json

>>> jdif /../ /.../
Unable to read file in '\..', please verify the path and filename alongwith the extension

>>> jdif a1.json b1.json 
Invalid json in 'b1.json'

>>> jdif a1.json b1.json
Empty json in 'b1.json'

>>> jdif a1.json b1.json
JSON is same in both the files

order of the keys might change within an object because we are first processing values then modified keys:

suppose if j1.json has:

{
    "key1": true,
    "key3": "abcd"
}

j2.json:

{
    "key4": false,
    "key3": ""
}
>>> jdif j1.json j2.json

[Example]

Features

  • Takes care of unicode, windows1252 characters, so the strings could be in any language or represent a symbol
  • Takes care of long descriptive values or keys
  • Takes care of empty valued strings
  • Instead of dumping into some other file, it displays the differences on the console itself

Metadata

Release files for json-diff-cli 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-diff-cli 1.0.2
File Size Uploaded
json_diff_cli-1.0.2.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-diff-cli 1.0.2
File Interpreter ABI Platform
json_diff_cli-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / json_diff_cli-1.0.2.tar.gz

Download URL json_diff_cli-1.0.2.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
23cb8c81b4ce8115f36131ebbb56e1f1a8f0cdf11da3230cf394f812a5d79f84
BLAKE2b-256 checksum
How to use checksums
84f4244cbb5da2c70063b291712b2bbe17047f4354d4c834bf391b1b31b7a836
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / json_diff_cli-1.0.2-py3-none-any.whl

Download URL json_diff_cli-1.0.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
222dc30a64d518bcc102a081701a73449dcf3b4a9080aac146e00dafd007714d
BLAKE2b-256 checksum
How to use checksums
a19affdf9737bf7d064d0984c043a57d3c067a5640e1d8a44a483ad607764b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page