Recursive tree compare for Python trees as used for the package 'json'.
Finds diff in native Python trees assembled by the standard package 'json'
and compatible, e.g. 'ujson'.
* leveltop
* levelbottom
* delta (for containers)
* scope(all, first)
* linewidth
* displaycharset (str,utf)
* pathonly
Args:
n0:
JSON string of type 'str', or 'unicode'
n1:
JSON string of type 'str', or 'unicode'
p=[]:
Result entries for each difference:
::
{'n0':n0,'n1':n1,'dl':dl,'p':p[:]}
#. first JSON data
#. second JSON data
#. diff count increment value
#. current diff including path
List of differences as of:
#. non equal types are different: type(n0) != type(n1)
#. equal types, both list: type(n0) is list
#. length is different: len(n0.keys()) != len(n1.keys())
#. at leats one item is different: n1.get(ni) and v != n1[ni]
#. equal types, both dict: type(n0) is dict and type(n1) is dict
#. length is different: len(n0.keys()) != len(n1.keys())
#. at leats one item is different: n1.get(ni) and v != n1[ni]
default:=0
Returns:
When no diffs returns True, else False or raises an exception.
The resulting differences are contained in the provided
list parameter 'p'. When not provided the resulting list
is suppressed.
Raises:
passed through exceptions:
|