How to read data from firebase?


Hi thunkable community!

How can I read the values in ‘Thumb’ list which is also under another list?


If the values in “Thumb” list do not have numeric keys, can I still read the last 5 values? I want to get the list of values under “Thumb” which may be either 0 or 1. I am not interested in the long string of serial numbers.

Thank you

One thing you can do is to export your Firebase database as JSON. And then paste it into Best JSON Viewer and JSON Beautifier Online. There, you can click on a value like “Thumb” or a serial # to see the path to that property.

My JSON tutorial explains how to parse the JSON once you’ve done that: API JSON Tutorial (Video)

Thank you for your fast response!

I have to read the firebase values in real-time, as new values are always getting updated every few seconds, where I need to get the last 5 values of each list (for example, Thumb)…

Do you know how I can get the last 5 values using Thunkable blocks only? And without putting the names ((the serial numbers) of the property into the blocks, as the serial numbers will change over time?

If you export the JSON from Firebase and paste it here (be sure to format it with the </> button in the forums toolbar), I can help with your question. It’s going to be something like the “Thumb[1]” property of the JSON object but again, without the actual JSON text it’s hard for me to be specific here.

Get the thumb bucket object
Get the keys in the object
Iterate over the keys within the object
Extract the relevant value and throw into a new variable

1 Like

thank you SO much for your response! I watched the video you sent as well as used the json formatter, they were very useful. After a couple hours of trial and error, I am able to get the data in Thunkable!

I am really grateful for all the help you gave even for all the other questions that I had posted!

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.