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

208
Visualizações
Firebase return data sometimes can be parse, sometimes not?

my problem solved.It's complicated. Let's us focus on this phenomenon.

my data structure

I have multiple layers, and I use tested Id : 1,2,3,4 , so firebase think my data id structure suppose to be :1,2,3,4,5... But the respond array or to say every array must have an index with 0 ..

It returns a 0 with null, cause I don't have 0 ,firebase made for me.(Suddenly,I seems like feelling the love with AI. To be honest...)

enter image description here

However, the real id is not '1,2,3,4' , I randomly enter an id '123455'.....

Firebase turns to be confused and realizes that 'oh! ,you data structure should not be an array. Let's try an deeply nest object...'

deeply nested objects data structure


Problem: when id = 1,2,3 , firebase make '0' for you when apply typeof() to it , it returns 'object' . However it actually an array...

when apply typeof() to it , it returns 'object' . However it actually an array... You can even use forEach() to it???

So how can I get the data return?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Because Javascript sometimes not reliable ... on typeof()..

const data  = await res.json();

console.log(Object.prototype.toString.call(data));

if it's an array . it will show [object Array] , if it's an object . it will show [object Object]

You can write two ways to parse data...

about 4 years ago · Juan Pablo Isaza 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