I would like to find the difference between two JSON but, when I try to use the DeepDiff method it finds nothing.
from deepdiff import DeepDiff
item1 = {
'__PythonResult__Modules': {
'b': {
'c':
['foo']
}
}
}
item2 = {
"__PythonResult__Modules" : {
"global" : {
"views" : {
"from_python" : {
"QDjl" : ["llll"]
}
}
}
}
}
DeepDiff(item1, item2)
I use Python 3.8 and DeepDiff 5.5.0. Do you have an idea ?
Thank you,
By default DeepDiff ignores private variables. These are field names that start with double underscore.
You can test this by adding a letter to the start of the underscore.
Anyway to preform comparison, simply set the parameter ignore_private_variables
to False
That is:
print(DeepDiff(item1, item2, ignore_private_variables=False))
Output:
{'dictionary_item_added': [root['__PythonResult__Modules']['global']], 'dictionary_item_removed': [root['__PythonResult__Modules']['b']]}