I have the following object
\"data\":{
\"name 1\":\"a\",
\"name 2\":\"b\",
\"name 3\":\"b\",
},
How can
If you use a reduce function you can do the following to achieve your goal
Object.keys(data).reduce((array, key) => {
return [...array, {key: data[key]}]
}, [])
Reduce is a cool function that iterates and combine data into one single item (could be 1 object, array, integer, etc).
Object.keys() is a way to get each key from the current object and be able to iterate over each.