I have a json file like as below
[{ "id": 2, "name": "Ali", "records":[{ "type": "L", "total": 123 }, { "type": "P", "total": 102 }] },{ "id": 3, "name": "Mete", "records":[{ "type": "O", "total": 100 }, { "type": "T", "total": 88 }] }]
I want to convert to like this
[{ "id": 2, "name": "Ali", record: { "type": "L", "total": 123 } },{ "id": 2, "name": "Ali", record: { "type": "P", "total": 102 } },{ "id": 3, "name": "Mete", record: { "type": "O", "total": 100 } },{ "id": 3, "name": "Mete", record: { "type": "T", "total": 88 } }]
how can i do it using javascript?