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

100
Visualizações
get JSON data from this structure [JQuery]

I'm trying to get json data from this structure:

"items": {
    "adidas": [
        {
            "name": "STAN SMITH PRIMEGREEN",
            "price": 84.9,
            "image": "https://m/dww/data/products/stan-smith-primegreen.png",
            "availability": [
                {
                    "size": 36,
                    "quantity": 5
                },
                {
                    "size": 37,
                    "quantity": 7
                },
                {
                    "size": 44,
                    "quantity": 9
                }
            ]
        }

I'm able to get this data using the below code is working:

const $showData = $("#show-data");

$.getJSON("data.json", (data) => {
const markup = data.items.adidas.map((item) => `
  
        <!--Product-->
               <img src="${item.image}" alt="shoes image" class="u-max-full-width">
               <h3 class="bold title">${item.name}</h3>
               <h2 class="price">${item.price}</h2>
               <p class="subtitle">${item.brand}</p>
               <p class="desc">${item.description}</p>
  
  `)
  .join("");

const list = $("<p />").html(markup);

$showData.html(list);

But when i tried to get availability array (size and quantity).

data.items.adidas.availability.map and i got this error:

Cannot read properties of undefined (reading 'map')
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