Convert datatype to JSON on backend?

Hi,

I need to be able to take an instance of a data type and do something like :convert to json. This exact feature apparently does not exist, but I’m wondering if there are work-arounds native to Bubble (preferred), or if someone could recommend a reliable 3rd party plugin to do this on the server side?

Thank you.

This plugin I think should help!

Do a search for:format as text and paste the JSON Struckture and adjust the this elements XXX in dynamic data.

2 Likes

There’s two options. The one mentionned by @michal.friedrich using format as text or when you return data from API, by default, this is a JSON. However, you don’t choose how to format the JSON in this case.

1 Like

Hey @matthewpomar - you can convert data or a list of data using the :format as text operator.

To give an example using User, you could use do a search for User’s :format as text or this User:converted to list:format as text.

You could then define the JSON object for each item in the list, for example:

{
“first name” : “this user’s first name”,
“id”: “this user’s unique id
}

If you need to convert JSON (as text) into something that Bubble can understand, you could use the plugin linked by Matt above.

1 Like