I have two JSON files named new and old that files have some data. here I want to compare new.json with the old.json file while comparing if I have the same data in those two JSON files I don't want to create any new JSON file
If I have different data like below in new.json and old.json
new.json:
[
{
"name": "Mohan raj",
"age": 23,
"country": "INDIA"
},
{
"name": "Kiruthika",
"age": 18,
"country": "INDIA"
},
{
"name": "Munusamy",
"age": 45,
"country": "INDIA"
},
{
"name": "John Wood",
"age": 35,
"country": "USA"
},
{
"name": "Mark Smith",
"age": 25,
"country": "USA"
}
]
old.json:
[
{
"name": "John Wood",
"age": 35,
"country": "USA"
},
{
"name": "Mark Smith",
"age": 30,
"country": "USA"
},
{
"name": "Oscar Bernard",
"age": 25,
"country": "Australia"
}
]
If the new.json file has any of the same data of old.json having we have to skip that data and the new.json file have any of the updated data of old.json having and the new data's in new.json we have to create a new JSON file named updated.json with the data of the above scenarios.
The resulted JSON file needs to look like this:
updated.json:
[
{
"name": "Mohan raj",
"age": 23,
"country": "INDIA"
},
{
"name": "Kiruthika",
"age": 18,
"country": "INDIA"
},
{
"name": "Munusamy",
"age": 45,
"country": "INDIA"
},
{
"name": "Mark Smith",
"age": 25,
"country": "USA"
}
]