How can I test whether two JSON objects are equal in python, disregarding the order of lists?
For example ...
JSON document a:
{
"errors": [
{"error": "invalid", "field": "email"},
{"error": "required", "field": "name"}
],
"success": false
}
JSON document b:
{
"success": false,
"errors": [
{"error": "required", "field": "name"},
{"error": "invalid", "field": "email"}
]
}
a and b should compare equal, even though the order of the "errors" lists are different.
解决方案
If you want two objects with the same elements but in a different order to compare equa