I'm trying to format the JSON response to the new format.
What would be the best approach to bring the expected results.
JSON RESPONSE
{
body: [{
id: 0,
data: [{
cellId: 0,
colId: 'A',
value: '*',
},
{
cellId: 1,
colId: 'B',
value: 'W',
},
{
cellId: 2,
colId: 'C',
value: 'ECE',
}
],
errors: [
{ colId: 'B', errorCode: 'msg_000' },
{ colId: 'D', errorCode: 'msg_001' }
]
}]
}
Expected format after conversion is
const convertedData = {
id: 0,
A: '*',
B: 'W',
C: 'ECE'
errors: [
{ colId: 'B', errorCode: 'msg_000' },
{ colId: 'D', errorCode: 'msg_001' }
]
}