Defining a list via API

Hello,

I am fetching a list of data… but bubble does not recognize the key list structure instead it is showing every single element in the list… for example

the following is part of the JSON response… it does not show me the nested info instead
{
“Meta Data”: {
“1. Information”: “Weekly Prices (open, high, low, close) and Volumes”,
“2. Symbol”: “MSFT”,
“3. Last Refreshed”: “2018-11-23”,
“4. Time Zone”: “US/Eastern”
},
“Weekly Time Series”: {
“2018-11-23”: {
“1. open”: “108.2700”,
“2. high”: “108.5600”,
“3. low”: “99.3528”,
“4. close”: “103.0700”,
“5. volume”: “150780076”
},
“2018-11-16”: {
“1. open”: “109.4200”,
“2. high”: “109.9600”,
“3. low”: “103.9100”,
“4. close”: “108.2900”,
“5. volume”: “180498817”

as you can imagine defining an endless number of items in the list does not make sense how to work around this ?

The data is a JSON object rather than a list.

To get it into a list format, you could

A. Process it before reading it into the API connector.
Example: a non-Bubble server or service reads the data, alters its structure to be more useful, responds to the API connector, which parses the data into a list of objects.

or B. Read it as a Text and process it after reading it in, with JSON functions.
Example for API workflow: using a server side script
Example for page workflow: using javascript.

or C. Ask for a different format from the provider.

2 Likes

hey mishav - I know this dates a little and was hoping you could assist…I too have the issue whereby Firebase is returning a JSON object which I need to manipulate as a list so that it can be used in a RG in Bubble…any direction on the JS script that can be run to manage this?

This is the raw response from Firebase:

{
  "bar1": {
    "address": "4 East Terrace, Sydney, 2000",
    "appStoreURL": "http://itunes.apple.com/app/idXXXXXXXXX",
    "description": "South African BBQ dishes and banquets prepared in a vibrant dining room with woven straw lampshades.",
    "imgURLs": [
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FAfricola-1b.jpg?alt=media&token=bf22f09e-1fc4-4275-9b1b-b7845ae054fd",
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FAfricola-2b.jpg?alt=media&token=035bbe78-c462-45f3-bd70-8dd13f324fe3",
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FAfricola-3c.jpg?alt=media&token=d5d34d54-a685-4fcc-8162-6892d7f2bbbb"
    ],
    "lat": -34.810585,
    "lon": 138.616739,
    "name": "Africola",
    "phone": "(08) 8223 3885",
    "status": "active",
    "venueImgURL": "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FAfricola-1b.jpg?alt=media&token=bf22f09e-1fc4-4275-9b1b-b7845ae054fd"
  },
  "bar2": {
    "address": "138/140 Gouger St, Sydney, 2000",
    "appStoreURL": "http://itunes.apple.com/app/idXXXXXXXXX",
    "description": "Disco Mexico, blends party vibes with fuss-free Mexican food in a small-bar setting.",
    "imgURLs": [
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FDisco_Mex_o.jpg?alt=media&token=60d76240-221c-415c-8d0d-7324d95a30ba",
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FDisco_Mex_2b.jpg?alt=media&token=037f8cc9-011d-4e22-aafc-8eef02dde88c"
    ],
    "lat": -34.848082,
    "lon": 138.599813,
    "name": "Disco Mexico Taqueria",
    "phone": "0416 855 108",
    "status": "active",
    "venueImgURL": "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FDisco_Mex_o.jpg?alt=media&token=60d76240-221c-415c-8d0d-7324d95a30ba"
  },
  "bar3": {
    "address": "12 Union St, Sydney, 2000",
    "appStoreURL": "http://itunes.apple.com/app/idXXXXXXXXX",
    "description": "With a deep southern soulful vibe, our team of award winning staff have dedicated themselves to providing unique choices and attentive service.",
    "imgURLs": [
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2Fmrgoodbar1-lrb.jpg?alt=media&token=4225765b-b526-4324-8cfe-4e9bcc6c9588",
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2Fmrgoodbar3-lrc.jpg?alt=media&token=5a6769eb-ee35-4b6a-abfd-3dcfc8ee78c0"
    ],
    "lat": -34.903885,
    "lon": 138.594948,
    "name": "Mr. Goodbar",
    "phone": "(08) 8223 7574",
    "status": "active",
    "venueImgURL": "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2Fmrgoodbar1-lrb.jpg?alt=media&token=4225765b-b526-4324-8cfe-4e9bcc6c9588"
  },
  "bar4": {
    "address": "45 King William St, Sydney, 2000",
    "appStoreURL": "http://itunes.apple.com/app/idXXXXXXXXX",
    "description": "Complete with elegant decor from the marble bar to the stunning chandelier, leading out to a stylish deck and balcony.",
    "imgURLs": [
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FMayfair-HotelHennessyBarLR-1b.jpg?alt=media&token=589f8374-6faa-4f05-b028-02b833bf315f",
      "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FMayfair-HotelHennessyBarLR-3-lrc.jpg?alt=media&token=a8aef437-00e4-46a1-80c5-370b887de0ba"
    ],
    "lat": -34.923312,
    "lon": 138.599197,
    "name": "Hennessy Rooftop Bar",
    "phone": "08 9876 5432",
    "status": "active",
    "venueImgURL": "https://firebasestorage.googleapis.com/v0/b/vipeeps-2018.appspot.com/o/venueImages%2FMayfair-HotelHennessyBarLR-1b.jpg?alt=media&token=589f8374-6faa-4f05-b028-02b833bf315f"
  }
}