I am completely lost when it comes to deciding on a suitable title for this piece. Here is the information I have retrieved from the API:
[
{
"order": 1,
"role": {
"label": "singer"
},
"artist": {
"name": "AaRON"
}
},
{
"order": 1,
"role": {
"label": "author"
},
"artist": {
"name": "Simon Buret"
}
},
{
"order": 2,
"role": {
"label": "author"
},
"artist": {
"name": "Olivier Coursier"
}
},
{
"order": 1,
"role": {
"label": "composer"
},
"artist": {
"name": "John Doe"
}
}
]
And here is the format in which I need to send the data:
"artist": {
"singer": [
"AaRON"
],
"author": [
"Simon Buret",
"Olivier Coursier"
]
}
The order property needs to be considered in the process.
For instance, Simon Buret should appear first as his order is set to 1.
I am clueless about how to go about implementing this, I attempted a map function but I am unsure of what should be included inside it :/
this.artistControl.controls.map(artistControl => {
...
});
Is there any way to achieve the desired outcome?