Parse array of json (jsonarray)

I have a query that fetches data from firebase db
I am trying to query sub-collections.
I did a map, to get the sub collection
But now i have an array, and i still need to show all the values under 0 and under collection id and both are variables. Usually i would do a loop to loop over all values.
How can i do that here?

Uhmmm this looks like just a transformation question but can you give an example of what you really want the output to be ?

Are you expecting an object like

    "-MR021-r5UKBmeSRRxZj" : { ...} ,
    "<the second key>": {...}  .....
1 Like

I just need to have a table that has columns
authentication, containers, deployed_by, ingress, ingress_url …

and another table that shows everything under containers too

ı have same issue. Can you help for parsing i the data to json file so I can upload its csv?

Hey all :wave:

It looks as though something like data.flatMap(Object.values) might work in this case. The Object.values function takes an object as its input and returns an array of the values it contains. In this case, the object would be a collection and its values would be sub-collections (which just happen to be objects themselves). So, passing something like

"-MR021-r5UKBmeSRRxZj" : subCollection1 ,
"<the second key>": subCollection2 .....

to Object.values would return [subCollection1, subCollection2]. Since it sounds like you may have a variable number of collections as well we can use flatMap to automatically concatenate all the sub-collections from different collections together into one table.

Can you let me know if that works for your use case? If not we can explore other options.