Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda