# How to read data from firebase?

**URL:** https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952
**Category:** Questions about Thunkable X
**Created:** [October 28, 2023, 5:06am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952 "2023-10-28T05:06:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zhen](https://avatars.discourse-cdn.com/v4/letter/z/a88e57/32.png) [@zhen](https://community.thunkable.com/u/zhen)
#### Post date: [October 28, 2023, 5:06am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/1 "2023-10-28T05:06:44Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/7/377e4ff0be3f1d31bd7f4013f72533d8f08bddf4.png)  
Hi thunkable community!

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/a/4a604a8745fc6a2f4a99de46fda2469d09e01f9c.png)  
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

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [October 28, 2023, 5:12am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/2 "2023-10-28T05:12:58Z")

</div>

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](https://codebeautify.org/jsonviewer). 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)](https://community.thunkable.com/t/api-json-tutorial-video/1140575)

---

<div class="post-metadata">

### Author: ![zhen](https://avatars.discourse-cdn.com/v4/letter/z/a88e57/32.png) [@zhen](https://community.thunkable.com/u/zhen)
#### Post date: [October 28, 2023, 5:46am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/3 "2023-10-28T05:46:20Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [October 28, 2023, 6:27am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/4 "2023-10-28T06:27:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [October 28, 2023, 9:56am UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/5 "2023-10-28T09:56:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![zhen](https://avatars.discourse-cdn.com/v4/letter/z/a88e57/32.png) [@zhen](https://community.thunkable.com/u/zhen)
#### Post date: [October 30, 2023, 1:32pm UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/6 "2023-10-30T13:32:52Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [January 28, 2024, 1:33pm UTC](https://community.thunkable.com/t/how-to-read-data-from-firebase/2667952/7 "2024-01-28T13:33:47Z")

</div>

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