Let say I have the following JSON
results = results.map(result => _.pick(result, ['id', 'vessel_type.id', 'emails[0].id'])); but only able to get the first email id
How do I get all email id without knowing the length of email array prior?
Is there something like results = results.map(result => _.pick(result, ['id', 'vessel_type.id', 'emails[*].id']));???
{
"results": [
{
"name": "VESSELRARARARARA",
"id": 2213,
"vessel_type": {
"id": 33
},
"emails": [
{
"id": 4733
},
{
"id": 4788
}
]
}
],
"totalCount": 555
}
I need to get id, vessel_type.id and all email id
{
"results": [
{
"name": "VESSELRARARARARA",
"id": 2213,
"emails": [
{
"id": 4733
},
{
"id": 4788
}
]
}
],
"totalCount": 555
}