I have 2 JSON object arrays in my java script and i am trying to figure out a way to output the differences (if any) between the 2.
for example, here is one of the arrays :
[{
"id":1,
"colour":"BLACK",
"size":"SML",
"qty":1,
"sml":"1"
}]
and here is another :
[{
"id":1,
"colour":"BLACK",
"size":"SML",
"qty":1,
"sml":"5",
"lrg":"1"
},
{
"id":2,
"colour":"BLACK",
"size":"SML",
"qty":1,
"sml":"1"
}]
In the above example i would print to the user that one product has been added, the id 1 product has had sml changed to 5 and lrg added. Is there a way to compare the 2 arrays and get the values that are changed / added?
id
only? – 31piy