Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda