I have compared two json file with deepdiff lib. But can figure Out the output. My output -
{'values_changed': {'root': {'new_value': '{\n "quiz": {\n "sport": {\n "q1": {\n "question": "Which one is correct team name in NBA?",\n "options": [\n "New York Bulls",\n "Los Angeles Kings",\n "Golden Staxx000xxxte Warriros",\n "Huston Rocket"\n ],\n "answer": "Huston Rocket"\n }\n },\n "maths": {\n "q1": {\n "questxxx000xxcion": "5 + 7 = ?",\n "options": [\n "10",\n "11",\n "12",\n "13"\n ],\n "answer": "12"\n },\n "qx0000xx2": {\n "question": "12 - 8 = ?",\n "options": [\n "1",\n "2",\n "3",\n "4"\n ],\n "answer": "4"\n }\n }\n }\n}', 'old_value': '{\n "quiz": {\n "sport": {\n "q1": {\n "question": "Which one is correct team name in NBA?",\n "options": [\n "New York Bulls",\n "Los Angeles Kings",\n "Golden Staxxxxxte Warriros",\n "Huston Rocket"\n ],\n "answer": "Huston Rocket"\n }\n },\n "maths": {\n "q1": {\n "questxxxxxcion": "5 + 7 = ?",\n "options": [\n "10",\n "11",\n "12",\n "13"\n ],\n "answer": "12"\n },\n "qxxx2": {\n "question": "12 - 8 = ?",\n "options": [\n "1",\n "2",\n "3",\n "4"\n ],\n "answer": "4"\n }\n }\n }\n}', 'diff': '--- \n+++ \n@@ -6,7 +6,7 @@\n "options": [\n "New York Bulls",\n "Los Angeles Kings",\n- "Golden Staxxxxxte Warriros",\n+ "Golden Staxx000xxxte Warriros",\n "Huston Rocket"\n ],\n "answer": "Huston Rocket"\n@@ -14,7 +14,7 @@\n },\n "maths": {\n "q1": {\n- "questxxxxxcion": "5 + 7 = ?",\n+ "questxxx000xxcion": "5 + 7 = ?",\n "options": [\n "10",\n "11",\n@@ -23,7 +23,7 @@\n ],\n "answer": "12"\n },\n- "qxxx2": {\n+ "qx0000xx2": {\n "question": "12 - 8 = ?",\n "options": [\n "1",'}}}
And the output I Want-
values_changed :
{
"quiz": {
"sport": {
"q1": {
"question": "Which one is correct team name in NBA?",
"options": [
"New York Bulls",
"Los Angeles Kings",
"Golden Staxxxxxte Warriros",
"Huston Rocket"
],
"answer": "Huston Rocket"
}
},
"maths": {
"q1": {
"questxxxxxcion": "5 + 7 = ?",
"options": [
"10",
"11",
"12",
"13"
],
"answer": "12"
},
"qxxx2": {
"question": "12 - 8 = ?",
"options": [
"1",
"2",
"3",
"4"
],
"answer": "4"
}
}
}
}
old_value _
{
"quiz": {
"sport": {
"q1": {
"question": "Which one is correct team name in NBA?",
"options": [
"New York Bulls",
"Los Angeles Kings",
"Golden Staxx000xxxte Warriros",
"Huston Rocket"
],
"answer": "Huston Rocket"
}
},
"maths": {
"q1": {
"questxxx000xxcion": "5 + 7 = ?",
"options": [
"10",
"11",
"12",
"13"
],
"answer": "12"
},
"qx0000xx2": {
"question": "12 - 8 = ?",
"options": [
"1",
"2",
"3",
"4"
],
"answer": "4"
}
}
}
}