I checked this thread on comparing JSON objects.
JSON a:
{
"errors": [
{"error": "invalid", "field": "email"},
{"error": "required", "field": "name"}
],
"success": false
}
` JSON b: with extra field
{
"errors": [
{"error": "invalid", "field": "email"},
{"error": "required", "field": "name"},
{ "key1": : "value2", }
],
"success": false
}
I want to compare these 2 jsons in python such that it will tell me
IF JSON is same and found extra key-value pair then it should give result that Found new field: { "key1: : "value2", } and rest of the json is same.
- If JSON is exactly same means if keys are matching in order then it will say TRUE.
- If JSON Keys are same but values are different then it will say, for the below keys the values are different.