My code =
This is my example data.
const songs = [
{
"title": "Just Once",
"asset_id": "1f7e0fd8-db21-4c28-b9e1-eb0295af198c",
"sort": 1,
"performers": [
{
"last_name": "John",
"first_name": "Doe",
"group": {
"group_id": "1e5f73fa-ffe8-4c70-a83b-84e7bf985b25",
"dept_short_name": "PAO",
"dept_long_name": "Public Affairs Office"
},
"email": "[email protected]"
}
]
}
]
const newTest= songs.map(( {...song} ) => (
song.performers.map(({...group}) => group_id = group.group_id)
))
and I am getting this as result:
I should just remove the dept_short_name and dept_long_name from group object and the group_id will be remain, and the rest of the data of the songs should be remained the same.
This should be the result:
[
{
"title": "Just Once",
"asset_id": "1f7e0fd8-db21-4c28-b9e1-eb0295af198c",
"sort": 1,
"performers": [
{
"last_name": "John",
"first_name": "Doe",
"group_id":"1e5f73fa-ffe8-4c70-a83b-84e7bf985b25"
"email": "[email protected]"
}
]
}
]
