Forum Academy Marketplace Showcase Pricing Features

Modifying API JSON Response to change available bubble data

Hi all,

I’m running a get API call that has a JSON response that returns properties based on a conversation. It looks like the below. After initializing the call that returned the below response, I have 3 new data types available in Bubble that are API call’s convo 1, API call’s convo 2, and API call’s convo 3… etc

I’d like for the API to treat convos as a list of items so that I could put all the convos into a repeating group which I can’t currently because all convos are it’s own data type. The list is also dynamic, sometimes there could be 4 items or 5 items or 10 so the fact that it creates a data type for each convo at the moment of initialization doesn’t actually work for the use case

I saw that there is the option to modify the JSON response and manually enter a response, so I tried adding a “data” level before the convo level but it doesn’t work. I think because the response that I’m getting from the API is actually formatted like the below.

I’m really only interested in the “room”: convo 1 level of data but across all convos. Any ideas on how I might modify the JSON or make changes in bubble to make that happen?

{
  "convo 1": [
{
  "room": "convo 1",
  "id": "1d896ded-5619-47a6-fd07-15383b00cf3d",
  "userId": null,
  "userName": "Test 1",
  "joinTime": "2021-06-07T04:43:34.000Z",
  "duration": 349
},
{
  "room": "convo 1",
  "id": "9ce8d482-6568-4b28-daaa-735e7092e0e8",
  "userId": null,
  "userName": "Test 2",
  "joinTime": "2021-06-07T04:47:43.000Z",
  "duration": 100
}
  ],
  "convo 2": [
{
  "room": "convo 2",
  "id": "0fc0d5eb-dab0-4fce-a803-3861abc2c958",
  "userId": null,
  "userName": "Test 3",
  "joinTime": "2021-06-07T04:48:40.000Z",
  "duration": 43
}
  ],
  "convo 3": [
{
  "room": "convo 3",
  "id": "0fc0d5eb-dab0-4fce-a803-3861abc2c958",
  "userId": null,
  "userName": "Test 4",
  "joinTime": "2021-06-07T04:48:40.000Z",
  "duration": 43
},
{
  "room": "convo 3",
  "id": "9ce8d482-6568-4b28-daaa-735e7092e0e8",
  "userId": null,
  "userName": "Test 5",
  "joinTime": "2021-06-07T04:47:43.000Z",
  "duration": 100
}
  ]

This is a dictionnary and Bubble doesn’t work really with this kind of data. You will need to transform the JSON before using it in Bubble