I have two JSON objects in Javascript, identical except for the numerical values. It looks like this:
var data = {
\"eth0\":{\"Tx\":\"4136675\",\"Rx\":\"13
This did the trick for me when dealing with a similar problem. It gets the differences in second compared to first.
var first = originalObj;
var second = modifiedObj;
var diff = {};
var differ = function(first, second, result) {
var i = 0;
for (i in first) {
if (typeof first[i] == "object" && typeof second[i] == "object") {
result[i] = differ(first[i], second[i], {});
if (!result[i]) delete result[i];
} else if (first[i] != second[i]) {
result[i] = second[i];
}
}
return isEmpty(result) ? undefined : result;
}
differ(old_conf, new_conf, diff);
Code is a bit of a special case, but you get the general idea :P