Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda