I have an object that looks like this:
{ \"1\": \"Technology\", \"2\": \"Startup\", \"3\": \"IT\", }
and I need to convert it to an a
You can use .map() with Object.keys():
.map()
Object.keys()
let data = { "1": "Technology", "2": "Startup", "3": "IT", }; let result = Object.keys(data) .map(key => ({id: Number(key), name: data[key]})); console.log(result);
Useful Resources: