Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!