So here i have two object data:
{
"obj1": {
"product": "Book",
"category": "sci-fi",
"title": "interstellar",
},
"obj2": {
"product": "Book",
"category": "horror",
"title": "evil dead",
},
"differences": []
}
From that data, i need to comparing each value from obj1
and obj2
variables find keys that have difference values from these two objects then pushing it into differences
variable.
Expected Result:
{
"obj1": {
"product": "Book",
"category": "sci-fi",
"title": "interstellar",
},
"obj2": {
"product": "Book",
"category": "horror",
"title": "evil dead",
},
"differences": [
"category",
"title"
]
}
Does anyone have recommendation to solving it?