https://github.com/python273/prettydiff
Diff parsed JSON objects and pretty-print it
https://github.com/python273/prettydiff
diff json python
Last synced: 3 months ago
JSON representation
Diff parsed JSON objects and pretty-print it
- Host: GitHub
- URL: https://github.com/python273/prettydiff
- Owner: python273
- License: mit
- Created: 2021-01-22T12:36:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T12:37:52.000Z (almost 5 years ago)
- Last Synced: 2025-04-11T04:18:56.513Z (9 months ago)
- Topics: diff, json, python
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 22
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prettydiff
**prettydiff** - diff parsed JSON objects and pretty-print it
> `$ python3 -m pip install prettydiff`
- [Custom output format example (HTML)](https://github.com/python273/prettydiff/blob/master/example_html.py)
## terminal
```python
from prettydiff import print_diff
a = {"a": "hello", "b": True, "c": [1, 3], "d": {"e": {"f": 1}}}
b = {"a": "world", "b": False, "c": [1, 2, 3]}
# to enable colors: $ python3 -m pip install prettydiff[terminal]
print_diff(a, b)
```
```diff
{
- 'a': 'hello',
+ 'a': 'world',
- 'b': True,
+ 'b': False,
'c': [
1,
- 3,
+ 2,
+ 3,
],
- 'd': {
- 'e': {
- 'f': 1,
- },
- },
}
```