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

119
Visualizações
How to get values on the third object of a Json with Javascript

I am doing a get request on JS and with the json reponse i want to get some values, for example product and color, but i don't know how i can go more deeper on the next levels of the objects of the Json.

the Json:

{    
"items": {        
    "1man": {
        "312favorites": {
            "155description": {
                "color": "red",
                "price": 2.76666
            }
          }
        }
    }

}

I just can go until the 1man level i don't know how to get the next levels, my code until now

console.log(response.data.items['1man']);

If i try for example console.log(response.data.items['1man'].312favorites i get error on VScode, i want go to until the color value...

Does someone can help me here?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have to do it this way:

response.data.items['1man']['312favorites']['155description'].color

The reason is that the key has some numbers, and it can't be accessed with Dot notation because it has to be without any numbers or special characters that's why you must use Bracket notation .

about 4 years ago · Juan Pablo Isaza Relatório
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