Using below code, I am able to group objects from my existing data with Underscore JS as shown.
{Group1: Array[10], Group2: Array[13], Group3: Array[16], Group4: Array[21], Group5: Array[38]}
//Create a category based on group assigned
var groupedData = _.groupBy(results, function (d) {
return d.groups;
});
console.log(groupedData);
But what I really need is to turn the above into JSON array looking like:
var myData = [["Group1", 10], ["Group2",13], ["Group3",16], ["Group4",21], ["Group5",38]];
How can I adjust my code in order to get the desired result?
Thank you for your help.