score:7

Accepted answer
const arr = []
Object.keys(MyObject).forEach(key => arr.push({name: key, value: MyObject[key]}))

Then access like this:

console.log(arr[0].name, arr[0].value) //id, jarvaniv (I prefer Zac)

score:2

You can simply use Object.entries:

const champObject = { id: "jarvaniv", key: "59", name: "Jarvan IV", sprite: { url: "http://ddragon.leagueoflegends.com/cdn/8.11.1/img/sprite/champion1.png", x: 96, y: 48 }, stats: { hp: 571.2, hpperlevel: 90, mp: 302.2, mpperlevel: 40, movespeed: 340 }, tags: ["Tank", "Fighter"], title: "the Exemplar of Demacia" }

const obj = Object.entries(champObject)

obj.forEach(([key, value]) => console.log(key, value))

You could optionally map it to an object for a more readable return object:

const champObject = { id: "jarvaniv", key: "59", name: "Jarvan IV", sprite: { url: "http://ddragon.leagueoflegends.com/cdn/8.11.1/img/sprite/champion1.png", x: 96, y: 48 }, stats: { hp: 571.2, hpperlevel: 90, mp: 302.2, mpperlevel: 40, movespeed: 340 }, tags: ["Tank", "Fighter"], title: "the Exemplar of Demacia" }

const obj = Object.entries(champObject).map(([key, value]) => ({key, value}))

console.log(obj)

score:4

You can use Object.keys method.

Object.keys(champ).map(
   (key) => champ[key]
);

or entries to get array of tuples [key, value]:

Object.entries(champ).map(
    ([key, value]) => ({ [key]: value })
);

Related Query

More Query from same tag