By utilizing d3.nest, I've organized this list through element grouping from another list.
array = [ {key: "6S", values: [{Id: "1234a", ECTS: 3},
{Id: "1234b", ECTS: 3}]},
{key: "7S", values: [{Id: "1534a", ECTS: 5},
{Id: "154b", ECTS: 4},]} ]
The goal is to transform the current format into something like this:
array = [{key: "6S", values: { 3: [{Id: "1234a"}, {Id: "1234b"}]}},
{key: "7S", values: { 5: [{Id: "1534a"}], 4: [{Id:"1534a"}]}}]
Specifically, I aim to group the data for each key (e.g. 6S, 7S) based on their ECTS values. Despite attempts with _.groupBy method, I encountered difficulties due to the objects being already grouped once. Any suggestions on how to effectively group these items?