var foo = [ { "a" : 15 }, { "b" : 25 }, { "a" : 15 }, {"c" : 13},{"c" : 13},{"c" : 13},{ "b" : 25 } ];
I would like to remove the duplicates and then sum up what's left. So the above would yield,
{ "a" : 15 },{ "b" : 25 }, {"c" : 13},
giving me 53
when I add what's left of the values.
I saw something similar here (Removing duplicate objects with Underscore for Javascript) but not really clear on how duplicates are removed.
I found the following solution but it did not work for me. http://bateru.com/news/2012/03/code-of-the-day-get-unique-objects-from-an-array-of-json-objects/
Any ideas? Thanks!