Below are two sets of data for objects:
{
"obj1": {
"product": "Book",
"category": "sci-fi",
"title": "interstellar",
},
"obj2": {
"product": "Book",
"category": "horror",
"title": "evil dead",
},
"differences": []
}
Using this data, I am looking to compare the values of obj1
and obj2
to identify keys that have differing values between the two objects and place them in the differences
variable.
Expected Outcome:
{
"obj1": {
"product": "Book",
"category": "sci-fi",
"title": "interstellar",
},
"obj2": {
"product": "Book",
"category": "horror",
"title": "evil dead",
},
"differences": [
"category",
"title"
]
}
Does anyone have any suggestions on how to solve this?