This is the utility for getting diff between two json or yaml files.
Bellow you may see the way to install and use the package:
pip install --user --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ kulakoff1988-gendiff
gendiff tests/fixtures/test_flat_old.yml tests/fixtures/test_flat_new.yml
The output in the string format by default:
{
constant: yep
- test: bar
+ test: foo
- foo: bar
+ bar: foo
}
gendiff tests/fixtures/test_nested_old.json tests/fixtures/test_nested_new.json
Output:
{
common: {
setting1: Value 1
- setting2: 200
setting3: true
- setting6: {
key: value
}
+ setting4: blah blah
+ setting5: {
key5: value5
}
}
group1: {
- baz: bas
+ baz: bars
foo: bar
}
- group2: {
abc: 12345
}
+ group3: {
fee: 100500
}
}
gendiff tests/fixtures/test_nested_old.json tests/fixtures/test_nested_new.json -f plain
Property "common.setting2" was removed
Property "common.setting6" was removed
Property "common.setting4" was added with value: "blah blah"
Property "common.setting5" was added with value: "complex value"
Property "group1.baz" was changed. From "bas" to "bars"
Property "group2" was removed
Property "group3" was added with value: "complex value"
To get diff between two files in json format use the command: