Convert Firebase dictionary to text file in the assets so it can be retrieved again as dictionary variable

Hi Koders!

I have several dictionaries stored in Firebase realtime database. They are dictionaries of dictionaries. I want to copy each one of them to a text file and store them in the assets, so I can convert them to a dictionary variable when needed. It could be better if I can store all of them in a json file with an index for each dictionary.

Is any of this possible?

I know I can do it manually with each dictionary, but I have to do this same procces maybe 40 times, and the dictionaries are quite long.

I don’t want the user to download directly from Firebase, I prefer them to be stored in the assets.
I leave one of this dictionaries here as example.

Text.txt (2.0 KB)

Thanks in advance!

Why do you want to save it as text file in asset? Instead get data and store it in tinydb and take it again even in offline…

I don’t want to use Firebase for this.

Quite interesting…

Thanks for your help (?)

There is no direct extension available in any community to download firebase datas into text or csv format. The direct way is extracting datas as json format only. If possible you can try creating an extension using this code

Well, I find the solution myself.
The Firebase dictionaries can be easily transformed into json just deleting the slashes in it and formatting it in a web like this:

After that, the json file is called with the File component and when retrieved, converted to a dictionary with the @Mohamed_Tamer great extension:

Thanks.

1 Like

This is what suggested you earlier , get json data(not a big one to convert into list) and save into tinydb and recover at any time. Well you are in different line

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