I have a loop that creates arrays like so but I want to find a way for grouping them from the fist values below I have show how the data is and the result I want how do I get the result from the data I have now.
['Brand', 'Workout', 12]
['Colour', 'Pink', 41]
['Fit', 'Regular', 238]
['Size', '10', 21]
['Type', 'T-Shirt', 139]
['Colour', 'Black', 71]
['Brand', 'Matalan', 13]
Brand: {
Workout: 12,
Matalan: 13
},
Colour: {
Pink: 41,
Black: 71
},
Fit: {
Regular: 238
},
Size: {
10: 21
},
Type: {
T-Shirt: 139
}