# API JSON parsing/format into bubble database

**URL:** <https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954>\
**Category:** APIs\
**Created:** [October 27, 2018, 12:20am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954 "2018-10-27T00:20:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 12:20am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/1 "2018-10-27T00:20:23Z")

</div>

Made a freelancer job description as i really want this to be working 😃 [https://codeless.pro/jobs/help-me-get-unstuck397](https://codeless.pro/jobs/help-me-get-unstuck397)

So i try to figure out how i can format the data from an API i call.  
This is the raw JSON:

{  
“response”: {  
“game\_count”: 142,  
“games”: [  
{  
“appid”: 4000,  
“playtime\_forever”: 48  
},  
{  
“appid”: 50300,  
“playtime\_forever”: 0  
},  
{  
“appid”: 55100,  
“playtime\_forever”: 0  
},  
{  
“appid”: 55110,  
“playtime\_forever”: 0  
},  
{  
“appid”: 55150,  
“playtime\_forever”: 132  
},  
{  
“appid”: 654310,  
“playtime\_forever”: 0  
}  
]  
}  
}

All i get is a list of “appid” and a list of “playtime\_forever” but the two values, despite being in an array, have no correlation it seems. So i can’t figure out if “appid”: 654310 has “playtime\_forever” \> 200 for example. I can’t display the “playtime\_forever” for any specific “appid” because they are not linked in any way.

Is there any way to have the data above be parsed into the database so i can actually use it?  
Some people seems to suggest the use of google sheets or charts but i can only see payed plugin in the store for this. I mean i should not have to use a payed plugin just to properly use the data of APIs -\_-

EDIT

the editor is set to public, really any help is appreciated am totally stuck with this database problem

> **[Bubble Editor - discordloginv1steam](https://bubble.io/page?name=index&id=discordloginv1steam&tab=tabs-1)**
>
> Build stuff without code and launch a startup without a tech-cofounder! Bubble is a visual programing language. Instead of typing code, use a visual editor to build applications.

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [October 27, 2018, 1:56am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/2 "2018-10-27T01:56:29Z")

</div>

It is inexplicable why Bubble does not properly handle arrays and subarrays from the API Connector. I keep trying to explain this, but they seem to not understand… or something.

I need to make a video.

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 3:40am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/3 "2018-10-27T03:40:10Z")

</div>

so you saying this is indeed not possible? i can’t parse the json data in a way that i can actually use them?

and yeah, i also can’t call any API arrays, otherwise i would do it directly with the API, because the API let’s me filter the APPIDs

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 27, 2018, 2:52pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/4 "2018-10-27T14:52:26Z")

</div>

> [@VanV](#):
>
> All i get is a list of “appid” and a list of “playtime\_forever” but the two values, despite being in an array, have no correlation it seems.

Can you share a screenshot of the API connector where it shows it is parsing the result?

I haven’t tried your example yet, but I’ve seen similar before, it should return a structure with games as a list of objects, that you can do something like:

response’s games :filtered (playtime\_forever \> 0)

And then get the individual field values

response’s games :filtered 's :first item 's appid

The whole result should be storable in the database if you create a data type’s field of type : (select the API result as a type).

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 3:08pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/5 "2018-10-27T15:08:23Z")

</div>

[![](https://i.imgur.com/bDr7qJb.png) ](https://i.imgur.com/bDr7qJb.png)  
not sure if that is what your requested, i created a own plugin to connect to the API not the connector

am gonna try to figure out what you mean with this 🙂

> The whole result should be storable in the database if you create a data type’s field of type : (select the API result as a type).

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 3:21pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/6 "2018-10-27T15:21:37Z")

</div>

well i think am done with this bubble stuff  
it just doesn’t make any sense to me  
[![](https://i.imgur.com/SLA8gTr.png) ](https://i.imgur.com/SLA8gTr.png)  
like really, it’s easier for me to learn all these coding languages than to figure out what bubble wants from me, disgusting, sry my tone but am really pissed since i worked hours on end on this to fix it and tried so many different approaches.

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 3:36pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/7 "2018-10-27T15:36:58Z")

</div>

I even tried the [dexi.io](http://dexi.io) app because i have the steamIDs and hours played on our forum saved in our mysql  
so i can parse the data from that mysql to get a specific set of appids/games only from this list: [http://united4games.com/most\_played\_steam\_games/test.html](http://united4games.com/most_played_steam_games/test.html)  
but i have the same problem again, i don’t know how to get the data into the bubble database correctly and this is what i could come up with: [https://i.imgur.com/WESABv0.png](https://i.imgur.com/WESABv0.png)  
i just need rows i can work with am going crazy because everything is there but i just can’t figure it out.  
So yeah, your help is much appreciated 🙂 you give me hope that it’s still possible and that it’s just me being stupid, i really hope i am because then it would be a problem that could be solved after all 🙂

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 27, 2018, 3:41pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/8 "2018-10-27T15:41:51Z")

</div>

Thanks for the screenshots, very helpful.

Very close there, the error does give a clue … You’ve defined the field as a response game, so it would only accept one item of the response games list.

If instead, in the field definition you tick the “list” checkbox, it will accept the whole list.

You can also send the list to a repeating group, and inside each cell you can reference a game’s appid, playtime\_forever, playtime\_2weeks.

Edit - a huge drawback of this approach is that the structure is frozen, to accept new fields in the games list objects requires re-initializing the API call, which then gives a new definition which can be saved in the database - I’m unsure if it automatically updates it, hopefully it does.

That’s why I’m a fan of keeping it as a JSON text.

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 27, 2018, 3:49pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/9 "2018-10-27T15:49:53Z")

</div>

> [@VanV](#):
>
> to get the data into the bubble database correctly and this is what i could come up with

What you’re seeing could be a list of texts displayed with commas, or a text with commas, you might find out more if you try to edit the row and the possible list field.

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 27, 2018, 3:58pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/10 "2018-10-27T15:58:49Z")

</div>

Not sure what you mean with “That’s why I’m a fan of keeping it as a JSON text.” because basically that’s what am trying, since in JSON they are all in an array, so i thought i could do the same with rows, so one row is one array and is correlated to each other.

i already send the list to a group but that does not let me work with it, it’s just a huge list of all games and playhours that is nice to look at but i can’t filter it properly.

i tried to set it up like you said, hope i did it right but it does not seem to work:  
i get this now [https://i.imgur.com/aStj9RB.png](https://i.imgur.com/aStj9RB.png)  
when i do this [https://i.imgur.com/T4d9is1.png](https://i.imgur.com/T4d9is1.png)

well i have to get into it again tomorrow with a clean head i guess 😃

EDIT!!!

it says am a new user and have no replies left, R.I.P

says must be text, that’s why i used text i think

[![](https://i.imgur.com/0MJekJW.png) ](https://i.imgur.com/0MJekJW.png)

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 27, 2018, 4:02pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/11 "2018-10-27T16:02:53Z")

</div>

> [@VanV](#):
>
> Not sure what you mean with “That’s why I’m a fan of keeping it as a JSON text.”

On the API Connector, if you choose the return type to be “Text” instead of JSON, Bubble doesn’t do the parsing, doesn’t setup those funky list structures, and you get the body as text, with the contents of the text in whatever form was sent.

This is often more useful if you are sending it back to another API, using it in Javascript, etc. The drawback is, Bubble doesn’t have any JSON functions and it makes it harder to search/filter etc. But all this can be done on server or client scripts anyway.

![image](https://us1.discourse-cdn.com/bubble/original/3X/1/8/186ea8af0c6fc2aeea164b3d14c853b135e08caa.png)

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 27, 2018, 4:05pm UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/12 "2018-10-27T16:05:54Z")

</div>

> [@VanV](#):
>
> i get this now

That looks empty … maybe its just the data editor being funky? What if you use the list in a Repeating Group?

EDIT - I tried something similar, and get the same weird result too.

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 28, 2018, 4:26am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/13 "2018-10-28T04:26:59Z")

</div>

am finally back let’s hope i can write longer before the next forum restriction kicks in 😃

so yeah, i get an empty list with this Steam API.  
I just tried it with the Discord API, same thing: [https://i.imgur.com/DLfuTSe.png](https://i.imgur.com/DLfuTSe.png)  
when i do this: [https://i.imgur.com/7eOEpFX.png](https://i.imgur.com/7eOEpFX.png)

no clue how to fix this but basically that’s all i need, a correct listing of the APIs data so i can use it in bubble.

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 28, 2018, 4:56am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/14 "2018-10-28T04:56:33Z")

</div>

Please tell me am missing something  
shouldn’t is just work, i get no errors, everything seems to work but it will have no data but only commas in the database

![](https://i.imgur.com/jNWjr3Z.png)  
 ![](https://i.imgur.com/MGX9eDU.png)  
 ![](https://i.imgur.com/h4OXWNP.png)  
 ![](https://i.imgur.com/wTtLyTk.png)  
 ![](https://i.imgur.com/v1iBBLX.png)

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 28, 2018, 5:14am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/15 "2018-10-28T05:14:47Z")

</div>

well i really don’t understand this, i can’t even get the repeating groups data i already see into the database  
[![](https://i.imgur.com/liqvhwB.png) ](https://i.imgur.com/liqvhwB.png)

[![](https://i.imgur.com/kfw8hW7.png) ](https://i.imgur.com/kfw8hW7.png)

[![](https://i.imgur.com/NJ6vyAf.png) ](https://i.imgur.com/NJ6vyAf.png)

it just makes no sense to me, please someone help, there must be anyone that just knows whats going on i mean it can’t be like this now, it seems so strange i can’t believe it 😃

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 28, 2018, 8:49am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/16 "2018-10-28T08:49:30Z")

</div>

Your data is in the database, but the App Data tab doesn’t seem to like showing API data structures. It’d be worth raising a bug for this.

You can verify this by setting a repeating group with data source as a search from the database.

Good you have retrieved from the API successfully!

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 28, 2018, 9:02am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/17 "2018-10-28T09:02:22Z")

</div>

yeah i can call it in the visual editor in the repeating group  
[![](https://i.imgur.com/DuQXgwg.png) ](https://i.imgur.com/DuQXgwg.png)  
[![](https://i.imgur.com/v12UffV.png) ](https://i.imgur.com/v12UffV.png)

but it will still not display anything in teh preview  
[![](https://i.imgur.com/fQCLkS7.png) ](https://i.imgur.com/fQCLkS7.png)

it has been now with any API i tried, the steam one and the [dexi.io](http://dexi.io) i tried to parse like this and it always only shows commas

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 28, 2018, 9:13am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/18 "2018-10-28T09:13:45Z")

</div>

Try using the API as a data source for the database, and the RG as a view element for either the database or the API.

On your RG data source you have a search for StreamDatas, but do you want to show a bunch of results, each one containing a list of game data, or the list of game data for a single StreamData?

You might need a nested repeating group … I’m a bit confused about your data structures now, the names seem to alter in every post 🙂

---

<div class="post-metadata">

**Author:** ![VanV](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vanv/32/30970_2.png) [@VanV](https://forum.bubble.io/u/VanV)\
**Post date:** [October 28, 2018, 9:23am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/19 "2018-10-28T09:23:10Z")

</div>

yeah because i try all kinds of things, right now :D:

login with steam on our forum \> database mySQL \> parsing only the game i need \> pulling it into a website \> extracting the data from the website with [dex.io](http://dex.io) \> accessing the parsed data from dex in bubble via their API \> making a webhook on zapier and parsing the data there into rows \> adding the rows into a google sheet via zapier: [https://docs.google.com/spreadsheets/d/1JHs74jc\_i\_Q3mqw72Euzw8VAWjQ\_2fvFSarPKyez74g/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1JHs74jc_i_Q3mqw72Euzw8VAWjQ_2fvFSarPKyez74g/edit?usp=sharing)

it’s crazy what i came up with i know, am just testing all kinds of approaches and this one is by far the most outrageous

maybe you can just have a look at the editor lol [https://bubble.io/page?name=index&id=discordloginv1steam&tab=tabs-1](https://bubble.io/page?name=index&id=discordloginv1steam&tab=tabs-1)

edit. and yeah the API i can parse into the sheets and i get a nice list, but i can’t seem to parse this nice list as i see it into the bubble database, that is where i got stuck.  
So when i could figure out how to get the data i have in the nice RG into the bubble database as rows, i would not need anything else pretty much to get unstuck here

edit2. not sure if you can see the previews [https://discordloginv1steam.bubbleapps.io/version-test?debug\_mode=true](https://discordloginv1steam.bubbleapps.io/version-test?debug_mode=true) but when you scroll down the list down below, i just need to get that list into the database, with each cell being a row in the bubble database

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [October 29, 2018, 12:57am UTC](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954/20 "2018-10-29T00:57:36Z")

</div>

Hey @VanV

I created a test page to mess around with … [https://discordloginv1steam.bubbleapps.io/version-test/test?debug\_mode=true](https://discordloginv1steam.bubbleapps.io/version-test/test?debug_mode=true)

The button creates a new database row from the API result.  
The first RG shows the API result.  
The second RG shows each StreamData row.  
The second RG shows the last saved API result in the database.

There was a problem with viewing the data, caused by privacy rules :

> **Screenshots**
>
> Originally …
> 
> ![2018-10-29%2011_52_34-discordloginv1steam%20_%20Bubble%20Editor](https://us1.discourse-cdn.com/bubble/original/3X/8/3/8304c08020fa48716ef6a4df9df554844822a5fa.png)
> 
> I changed the default so all can view, I don’t know what you want with the custom one so I left it broken …
> 
> ![2018-10-29%2011_54_52-discordloginv1steam%20_%20Bubble%20Editor](https://us1.discourse-cdn.com/bubble/original/3X/f/f/ffe753f1e86cd47ac4a8b8685ac7ca1e6721704a.png)

I hope that gets you over the hurdle and back on the track!

Edit - on your index page, the first RG data source is each StreamData row, which means each cell’s execution result is a list, but you are showing the fields as if it is one item.

It would make more sense to show the execution result list in its own RG, this can be done with selecting a single item of StreamData, or by nesting the RG in a StreamData RG.

[Next page](https://forum.bubble.io/t/api-json-parsing-format-into-bubble-database/40954.md?page=2)
