You can try something like this, just using an array as a container for the final desired output, and loop over the original object with for ... in loop. Hope this helps. :)
var p = {
"0": "Proxy",
"2": "Skate",
"8": "Air"
}
var a = [];
for(var key in p){
if (p.hasOwnProperty(key)) {
a.push({name: p[key]})
}
}
console.log(a)
Another way to loop through an object is to use Object.entries method, This method return an array of arrays, each array contain the key and the value
const fruits = {
apple: 28,
orange: 17,
pear: 54,
}
const entries = Object.entries(fruits)
console.log(entries)
// [
// [apple, 28],
// [orange, 17],
// [pear, 54]
// ]
So, in your case you can try something like this :
const entries = Object.entries(p);
var a = [];
for (const [key, value] of entries) {
a.push({name: value})
}
return {name: value}Object.values(partners).map(name => ({name}))