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

145
Views
how to get the specific key data from multidimensional array in react?

I am working with an API where I got data in this format:-

[
  0:{
    id: "1"
    name: "ttp"
    platforms:{
       one: "false",
    }
  },

 1:{
    id: "2"
    name: "spt"
    platforms:{
       one: "true",
       two: "true",
    }
  },
},
]

The data is very large it has more than 100 indexes. I want to check if platforms are present in the index. Suppose if any index contains platform one I want to show its id and don't want to show that index that doesn't have platform one. But I am how to do this in React.

Here the code I want to change, Don't want to use the index [0]

if (response.status === 200) {
    console.log(response.data)
    list = response.data[0].platforms;
 }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use filter() to filter your array and get just the elements you need based on a condition.

In your case :

if (response.status === 200) {
    console.log(response.data)
    list = response.data;
    const filteredList = list.filter( (e: any) => (e.platforms.one));
    // filteredList contains just the objects that contains the value one
}
about 4 years ago · Juan Pablo Isaza Report
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!