i’m facing issue to convert object into array of object. i’m having object like,
const employeeDetails = {
"admin-name": "deepak",
"admin-age": "29",
"tester-name": "raju",
"tester-age": "26",
};
i’m expecting format like,
const employeeDetails = [
{
_id: "admin",
name: "deepak",
age: 29,
},
{
_id: "tester",
name: "raju",
age: 26,
},
];
3
Answers
You can do: