0
I am trying to traverse an array where the returned index is string (are names). I know how to walk when they come with 0,1,2,3... but with string I’m struggling. The return is as follows:
Aatrox: {version: "10.3.1", id: "Aatrox", key: "266", name: "Aatrox", title: "the Darkin Blade", …}
Ahri: {version: "10.3.1", id: "Ahri", key: "103", name: "Ahri", title: "the Nine-Tailed Fox", …}
Akali: {version: "10.3.1", id: "Akali", key: "84", name: "Akali", …}
// e assim vai 150 linhas mais o menos.
How can I go one by one and take only the name
and the key
? I tried to create this code below, but it does not work.
this.http.get('http://ddragon.leagueoflegends.com/cdn/10.3.1/data/en_US/champion.json').subscribe((resC) => {
var champions = JSON.parse(resC._body)
console.log(champions.data) // aqui retorna a lista inteira, mas preciso das keys e names somente. da pra fazer ['Aatrox'], mas como coloca no for pra rodar sozinho sem especificar o nome do campeão?
for(const char of champions.data) {
console.log(char)
}
});