This is what my current object looks like.
My question is how to parse this object such that it will return the expected output (without index 0,1,2…) I want a Javascript array of objects, without the key value.
"contacts": {
"0": {
"firstName": "James",
"lastName": "April",
"emails": [
{
"emailType": "WORK",
"address": ""
},
{
"emailType": "PERSONAL",
"address": ""
}
],
"relationship": "boyfriend",
"phones": [
{
"phoneType": "HOME",
"phoneNumber": "(456) 888-9999"
},
{
"phoneType": "CELL",
"phoneNumber": "(789) 123-4567"
},
],
"callSequence": 0,
"note": null
},
"1": {
"firstName": "Joe",
"lastName": "Kimmel",
"emails": [
{
"emailType": "WORK",
"address": ""
},
{
"emailType": "PERSONAL",
"address": ""
}
],
"relationship": "ex-husband",
"phones": [
{
"phoneType": "HOME",
"phoneNumber": ""
},
{
"phoneType": "CELL",
"phoneNumber": "(111) 111-1111"
},
{
"phoneType": "WORK",
"phoneNumber": ""
}
],
"callSequence": 0,
"note": null
},
"2": {
"firstName": "Test",
"lastName": "",
"emails": [
{
"emailType": "WORK",
"address": "[email protected]"
},
{
"emailType": "PERSONAL",
"address": "[email protected]"
}
],
"relationship": "BROTHER-IN-LAW",
"phones": [
{
"phoneType": "HOME",
"phoneNumber": ""
},
{
"phoneType": "CELL",
"phoneNumber": ""
},
{
"phoneType": "WORK",
"phoneNumber": ""
}
],
"callSequence": 0
}
}
}
Expected Result
Wihout the indexes 0,1,2 and should be inside an array. So I want the output as array of objects
"contacts": [{
{
"firstName": "James",
"lastName": "April",
"emails": [
{
"emailType": "WORK",
"address": ""
},
{
"emailType": "PERSONAL",
"address": ""
}
],
"relationship": "boyfriend",
"phones": [
{
"phoneType": "HOME",
"phoneNumber": "(456) 888-9999"
},
{
"phoneType": "CELL",
"phoneNumber": "(789) 123-4567"
},
],
"callSequence": 0,
"note": null
},
{
"firstName": "Joe",
"lastName": "Kimmel",
"emails": [
{
"emailType": "WORK",
"address": ""
},
{
"emailType": "PERSONAL",
"address": ""
}
],
"relationship": "ex-husband",
"phones": [
{
"phoneType": "HOME",
"phoneNumber": ""
},
{
"phoneType": "CELL",
"phoneNumber": "(111) 111-1111"
},
{
"phoneType": "WORK",
"phoneNumber": ""
}
],
"callSequence": 0,
"note": null
}]