API JSON response

Is it possible to retrieve the raw JSON from an API response and access the raw JSON from within Bubble? For example, I’d like to just bring in the raw JSON and display it in a display box of some kind?

Thanks

1 Like

Hi @ling.jamesm,

If you set the Data type on the api call properties to Text, you’ll get the raw response.

24%20PM



Looking to improve your Bubble™ skills?

Let me turn
:thinking: :tired_face: :confounded:

into
:grinning: :sunglasses: :woman_student:

Coaching and Development at https://uniqueideas.com or schedule a free intro session :gift:

Ken Truesdale
LinkedIn

Thanks, that is helpful. I would ideally like to use Bubble’s automatic parsing of the JSON as data to get individual elements, but also show the raw data? Is that possible?

1 Like

How about duplicating the api call in the plugin, one as text, one with json? Then just use the format you need for different circumstances.

That would work except the API I am accessing requires a unique ID for each request, meaning that the second API request is treated by the resource I am accessing as a separate and subsequent request. This is not ideal, although I might need to accept this limitation. The alternative is whether I could parse the JSON response and strip out the key-value pair data …but I am not sure if Bubble allows that kind of logic?

Here are a couple options:

  1. Go with JSON and let Bubble parse. Then when displaying back to the user, format everything back to a text string. Take a look at the tools that are found within the Toolbox or other plugin to get that done.

  2. Go with raw text and parse with javascript.

My js skills are limited, so I’d be going with #1, but somebody else might be able to help with #2 or even another approach!

4 Likes