I have a JSON data and I need to do something like group by and i asked this question before here but i am not getting any satisfied answer so this time i would like to expl
You can do that easily with Underscore.js:
_.chain(myObject.Apps[0].groups).sortBy("author").groupBy("author").value();
Outputs a JSON object:
{
"John":[{"id":"4","name":"test group 4","category":"clinical note","author":"John"}],
"LKP":[{"id":"2","name":"test group 2","category":"clinical image","author":"LKP"}],
"RRP":[{"id":"1","name":"test group 1","category":"clinical note","author":"RRP"},{"id":"3","name":"test group 3","category":"clinical document","author":"RRP"}]
}