I have this JSON data which has structure similar to
data =[{"name":"A","Date":"10/19/2015","OnTime":"0.1","Purpose":"x","OffTime":"0"},
{"name":"A","Date":"10/19/2015","OnTime":"0.3","Purpose":"x","OffTime":"0"},
{"name":"B","Date":"10/19/2015","OnTime":"0.01","Purpose":"y","OffTime":"0"},
{"name":"C","Date":"10/19/2015","OnTime":"0.02","Purpose":"z","OffTime":"0"},
{"name":"C","Date":"10/19/2015","OnTime":"0.01","Purpose":"x","OffTime":"0"}
{"name":"A","Date":"10/20/2015","OnTime":"0.01","Purpose":"x","OffTime":"0"}]
I am trying to group and add the OnTime value for name and Date. For example the total Ontime value for A on date 10/19/2015 Expected O/P :
dataout = [{"name":"A","Date":"10/19/2015","OnTime":"0.4"},
{"name":"A","Date":"10/20/2015","OnTime":"0.01"},
{"name":"B","Date":"10/19/2015","OnTime":"0.01"},
{"name":"C","Date":"10/19/2015","OnTime":"0.03"}]
I tried using searching for the solution but found the solution for single Key addition but not for multiple keys. I also tried using underscore js but was unable to get the expected output. Please help, thanks.