Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
How to access to the value of this object from the json file?

Im trying to get the values inside of "info" value but the browser show me something like undefined or object, object.

this is the code

const loadCharacters = async () => {
    try {
        const response = await fetch('https://naruto-api.herokuapp.com/api/v1/characters');
        narutoCharacters = await response.json();
        displayCharacters(narutoCharacters);
    } catch (err) {
        console.error(err);
    }
};

const displayCharacters = (characters) => {
    const htmlString = characters
        .map((character) => {
            return `
            <li class="character">
                <h2>${character.name}</h2>
                <p>${character.id}</p>
                <p>${character.info[0]}</p>
            </li>
        `;
        })
        .join('');
    charactersList.innerHTML = htmlString;
};

loadCharacters();

json

[
  {
    "about": [
      "Akatsuchi (赤ツチ, Akatsuchi) é um shinobi de Iwagakure."
    ],
    "info": {
      "Sexo": "Masculino",
      "Aniversário": "11 de Janeiro",
      "Idade": "Parte II: 20 anos",
      "Altura": "Parte II: 2.00 m",
      "Peso": "Parte II: 137 kg",
      "Tipo Sanguíneo": "B",
      "Ocupação": "Guarda-costas do Tsuchikage",
      "Afiliação": "Iwagakure",
      "Parceiro": "Kurotsuchi",
      "Patente Ninja": "Fase II:  Jōnin",
      "Registro Ninja": "IW-08718"
    },
    "page": "https://naruto.fandom.com/pt-br/wiki/Akatsuchi",
    "name": "Akatsuchi",
    "id": 1,
    "images": [
      "https://gkbzmcahsvowlfjslvnm.supabase.in/storage/v1/object/public/characters/Akatsuchi.webp",
      "https://gkbzmcahsvowlfjslvnm.supabase.in/storage/v1/object/public/characters/Akatsuchi_1.webp"
    ]
  }

I'd try to acces it using character.info[0], character.info['Altura'] but this doesn't work, I'll really appreciete if someone can help. Thanks

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda