I have a json response in the form :
some_array = [{
ios: "110"
rate_pl: "PlanC"
ref_site: "N/A"
reservation_id: "12709034"
},{
ios: "121"
rate_pl: "SomePlan"
ref_site: "FB"
reservation_id: "1273034
},{
ios: "141"
rate_pl: "PlanC"
ref_site: "Tweet"
reservation_id: "143034
}];
How do i group a particular attribute say 'rate_pl' and also add the values if the ios which related to that particular rate_pl.
example --> Result should be:
someObject = [
{PlanC: ['ios':251]}, //(110+141 = 251)
{SomePlan: ['ios':121]}
];