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

207
Views
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 answers
Answer question

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 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!