def diff(a, b):
delta = diff(a, b)<EOL>if not a:<EOL><INDENT>return delta<EOL><DEDENT>for item in delta:<EOL><INDENT>if isinstance(a[item], list):<EOL><INDENT>if delta[item] == []:<EOL><INDENT>delta[item] = {JSONUtils.DIFF_DELETE : a[item]}<EOL><DEDENT>elif isinstance(delta[item], dict):<EOL><INDENT>for key in delta[item].keys():<EOL><INDENT>if str(key) == JSONUtils.DIFF_DELETE:<EOL><INDENT>delta_upd = {JSONUtils.DIFF_DELETE : []}<EOL>for i in delta[item][key]:<EOL><INDENT>delta_upd[JSONUtils.DIFF_DELETE].append(a[item][i])<EOL>delta[item] = delta_upd<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return delta<EOL>
Compares JSON objects
:param a:
:param b:
:return: difference object a vs b