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

142
Vistas
Iterate over JSON child array to find specific Id

I am making an API call:

const idVal = 59
APIGet(resource, params)
        .then((res) => {
            console.log(res.data.body)
            setData(res.data.body)
        })

console.log(res.data.body) returns:

Array [ {…} ]

0: Object { Id: 978, UniqueHash: "uZIYvh", Title: "testval", … }
​​
Id: 978
​​​​
Title: "Title for product"
​​
UniqueHash: "uYvh"
​​
organizers: Array [ {…}, {…} ]
​​​
0: Object { Id: 1, Name: "Store", Description: "store description", … }
​​​
1: Object { Id: 59, Name: "Conference", Description: "conference text", … }
​​​
length: 2
​​​
<prototype>: Array []
​​
<prototype>: Object { … }
​
length: 1

I would need to get the 'organizers' by Id (59 in this example). How would I go about adapting the code to go through the organizers.Id and to only get the organizer data based on a specific Id? I guess its iterate over the res.data.body.organizers to see if organizers.Id === const idVal?

Please note that the length of the main object is always 1, while 'organizers' can be many.

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