How do get the first element of this JSON




I have this Firebase database structure that I am trying to import into my app. How do I get the first element “van1” without explicitly calling van1 but usin in list get #1? I have googled for several hours now and I’m still at a lost. I trying to get the Brand name of van1.

Can anyone point me in the right direction on how to access this JSON object. It’s not a array of objects. I think that’s where I have the problem. I need the JSON to be [{},{}] and not {{},{}}



Thanks for the fast reply. However lets say that I will not have an idea about the “van1” key. I know VEHICLES exists but inside VEHICLES are items which have unique ids… How can I get the first item in the list of items in VEHICLES?


So one way would be to call vehicles and get the list and then use the get#1fromlist block in the list drawer. you would have to parse the list but thats not super hard.


I tired this but it does not work

Perhaps I dont have a correct understanding of how Firebase DB structures should be created.


No, you have to clean the data up that is going into the list. When you get the data back from firebase, it will have ALL the data from vehicles. You have to remove the pieces of data you dont want. I’ll see if I can make an example for you.


OK, here ya go. Try this out and it should give you a list of the FIRST items and then you can call each item as you wish. Also you are replacing the characters with blank boxes, so basically deleting them so it is easier to work with the data.


wow thanks a lot! will try it out ASAP!


I use a label and a list viewer so I can see the json I am working with. It helps me figure out where I need to split my data. I am sure there is a better way to do this but thats how I found works for me.


Thank you very much!



Did that solve your issue? If so, please click on the three dots on the reply that was the answer and click solved.



I haven’t had time yet. I can only work on my apps during nighttime. Gotta have a day job too!




Your solution gave me the right path to follow but holy cow that’s a lot of work just to get a list. Is there really no other way to sort of iterate through the JSON object?


Hello there, @chuava45kiu! :wave:

Since you want to make apps/code anything, u should not look for any shortcuts. Sometimes code will be < 1000 lines / 1000 blocks. You need to have a habit of dealing with large no. of blocks… :sweat_smile: :+1:

But anyways, try this :

(I just formatted a little, the code is same as stated by @samclever)

&, for Mind Satisfaction, that - “The blocks are too much!”, try right-clicking the block, and click collapse. The screen will look clean.

Hope it helps :smile:
Thanks :wink:


@chuava45kiu, A couple of things to note.

We are currently working on adding a block that will allow you to get all the properties of an object. So in your case you could get a list that would look like ["van1", "van2", "van3", ...]. Then you could iterate over that list and plug those values into the 'get property' block.

Another thing to note is that if you are in control of that Firebase DB then you could presumably store the VEHICLES as a list rather than as an object. Then you could access it the way that you want to (i.e., by simple index). If you are in control of that Firebase DB, can you share the blocks that you use to store the data? If we see that, we could probably suggest how to change it so that it stores the vehicles as a list.


Hi All,

I solved my problem by using simple keys in my Firebase DB. Using predictive keys like van1,van2, van3 and so on I can use substrings to get the data I need. And yes I have full control on the DB. Its not ideal but it will have to do for now.



I need someone who knows about API and JSON. I want to select a CITY from list 1 and after show the towns of the selected city in list 2. I couldn’t solve my problem. Can someone check what is wrong?


To get started, try your browser to get the desired results for your query. I did not succeed in this, because there was an error in the request text.