i have a list in json and ai need it with unique values
[
{
"equipmentType": "5 MEG DOCSIS",
"status": "On Truck ",
"count": 2
},
{
"equipmentType": "5 MEG DOCSIS",
"status": "Return Faulty",
"count": 3
} ]
I need like that with unique equipmentType :
[
{
"equipmentType": "5 MEG DOCSIS",
"On_TruckCount": 2,
"Return_Faulty": 3
}
]
Help me to find out solution of that problem Thanks in advance..
EDIT
I am trying with that but its wrong, here obj is json obj.
$scope.equipmentDashboard = obj;
$scope.oldEquip="";
$scope.listtest='';
$scope.test = [];
angular.forEach(obj, function(value, key) {
if(value.equipmentType == $scope.oldEquip.equipmentType){
if(value.status=="On Truck ")
$scope.listtest.onTruck = value.count;
else
$scope.listtest.returnFaulty = value.count;
} else {
$scope.test.push($scope.listtest);
$scope.oldEquip = value;
}
});