I have some problem in creating the required form of an array. I want to delete the key named service_id and put their data into the outside.
"restaurant_services": Array[2][
{
"service_id": {
"added_on": "2018-07-07T07:56:35.054Z",
"deleted": false,
"_id": "5b4072332c94ca607ffcf65b",
"service_name": "Cafe",
"service_status": 1,
"__v": 0
},
"_id": "5b433cd7e066e6623b9c9ce6"
},
{
"service_id": {
"added_on": "2018-07-07T10:01:05.083Z",
"deleted": false,
"_id": "5b408f61caeca976851923c4",
"service_name": "Dine In",
"service_status": 1,
"__v": 0
},
"_id": "5b433cd7e066e6623b9c9ce5"
}
],
i would like to convert the above array to below.
"restaurant_services": Array[2][
{
"added_on": "2018-07-07T07:56:35.054Z",
"deleted": false,
"_id": "5b4072332c94ca607ffcf65b",
"service_name": "Cafe",
"service_status": 1,
"__v": 0
},
{
"added_on": "2018-07-07T10:01:05.083Z",
"deleted": false,
"_id": "5b408f61caeca976851923c4",
"service_name": "Dine In",
"service_status": 1,
"__v": 0
}
],
Any Suggestion For that to covert this type of array?
arr.map(({service_id})=>service_id)$replaceRootoperator?