I have an array which looks like this:
var arr = [
{id: 1, tech_id:11, action: 'swim'},
{id: 2, tech_id:11, action: 'run'},
{id: 3, tech_id:22, action: 'climb'},
{id: 4, tech_id:22, action: 'swim'},
{id: 5, tech_id:11, action: 'jump'},
]
How do I make it to look like this:
[
{tech_id: 11, data: [{id: 1, action:'swim'}, {id: 2, action:'run'}, {id: 5, action:'jump'}] }
{tech_id: 22, data: [{id: 3, action:'climb'}, {id:4, action:'swim'}]}
]