I need some help to convert JSON array to multidimensional array, I keep getting stuck.
I am also tried with _.groupBy in underscore.js but it's not working for the nested array.
If any possible to convert from the following
[{
"subject": "physics",
"student_id": "2569",
"values": "0.152,0.228,0.218"
}, {
"subject": "maths",
"student_id": "1236",
"values": "0.146,0.22,0.212"
}, {
"subject": "chemistry",
"student_id": "4569",
"values": "0.159,0.234,0.224"
}, {
"subject": "physics",
"student_id": "1478",
"values": "0.16,0.235,0.225"
}]
Expected Result should be
{ 'physics': {
'2569': "0.152,0.228,0.218",
'1478': "0.16,0.235,0.225"
},
'maths': {
'1236': "0.146,0.22,0.212"
},
'chemistry': {
'4569': "0.159,0.234,0.224"
} }
Please provide me with a simple solution.