Forum Academy Marketplace Showcase Pricing Features

Open App - JSON parsing

Hi All,

I have created an endpoint called “trip” in the bubble Open App (accessible to everyone):

I will be sending a JSON of the following format, from zapier:
{
"flight":{

  "arrival":{  
     "name":"Newark Liberty International Airport",
     "local-date-time":"2012-02-19T21:43:00",
  },

  "provider-details":{  
     "name":"Continental Airlines"
  },

  "details":{  
     "@number":"1573",
  },

  "departure":{  
     "name":"San Francisco International Airport",
     "local-date-time":"2012-02-19T13:20:00",
  },
  "record-locator":"NJS8YH",

},
}

In bubble, I created a thing called “Flight”, which needs to be populated based on the information available in the JSON payload.

How do I define the keys for the bubble endpoint “trip”, so that the linked workflow “Create a new flight” populates the database with the correct information?

The mapping of the fields in thing “Flight” to the JSON keys is as follows:

  • Airline = flight --> provider-details --> name

  • Flight Number = flight --> details --> @number

  • Departure Airport = flight --> departure -> name

  • Departure Date = flight–> departure --> local-date-time

  • Arrival Airport = flight --> arrival -> name

  • Arrival Date = flight–> arrival --> local-date-time

  • Booking Reference = flight–> record-locator

I’m having difficulty mapping the JSON keys to the bubble endpoint “trip” so that the related workflow for creating a flight works properly.

If someone can help me get started on the mapping information for endpoint and the related workflow, that would be great !

Thanks!

That’s what the ‘Add a new parameter’ button is for. Click on this and you’ll be able to define the keys for the JSON you’re sending.

1 Like

Yes, you will need to do the work on the Zapier end to send through the parameters in this case.

Hi Nigel & Emmanuel,

Thanks for your feedback and help!

I did as Emmanuel suggested:

  1. Used “Add a new parameter” to add just one parameter, record-locator from the JSON payload.

  1. Updated the associated workflow to map this parameter to a field in the thing Flight.

After setting this bubble endpoint “trip”, I posted the JSON payload to this bubble endpoint from Zapier.

I get the error below.

My guess is that the parameter record-locator is nested, as in, one needs to work your way down the JSON tree, like so: Go to Flight node then get value for record-locator branch.

I do not think I have properly defined the parameter record-locator in the endpoint “trip”.

How do I go about doing this correctly? What is the syntax to be used?

Or is there a bubble limitation? Can bubble only accept flat (one level) JSON payloads?

Any help in pointing me in the right direction would be much appreciated!

Thanks!

I am interested in the answer to this question as well.
“Add a new Parameter” in the API endpoint definition, does not seem to pick up nested entries in the JSON payload. Bubble experts please help.

It does pick that up, parameters have to be flattened for now. When we say we don’t lose info from JSON objects it’s for responses when using the API connector, a totally different context.