let arr = [ { Category:‘A‘, Amount:1, },{ Category:‘B‘, Amount:2, },{ Category:‘A‘, Amount:3, },{ Category:‘C‘, Amount:4, },{ Category:‘B‘, Amount:5, },{ Category:‘C‘, Amount:6, },{ Category:‘A‘, Amount:7, },{ Category:‘C‘, Amount:8, } ]; let temp = {}; let end = []; for(let i = 0; i < arr.length; i++){ let a = arr[i]; if(!temp[a.Category]){ end.push({ Category: a.Category, data: [a] }); temp[a.Category] = a; }else{ for(let j = 0; j < end.length; j++){ let b = end[j]; if(b.Category == a.Category){ b.data.push(a); break; } } } }; console.log(end);