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

124
Views
How do i get the total count of data objects in this API response

Im trying to write a code that retrieves data from a db and verifies if its matches the data that is synced in an online tool For that i need to know the number of ROWS created in the db table for comparison. A table is created for each entry and it goes something like this:

type: list
data: [ 
       {count 1},
       {count 2},
       {count 3}
       ]

now i need to get the number of "counts" in this object (which is 3 in this example). Some API's have a total_count tag which is helpul in getting me my info. but others dont. Anyway i can get that number?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If your Response is allways in an Array use Array.length

let apiRes = {data: [1,2,3]};
console.log(apiRes.data.length);

about 4 years ago · Santiago Trujillo 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!