Forum Academy Marketplace Showcase Pricing Features

Any hot tips on saving and retrieving JSON to the database?

Hi everyone!

I’ve recently explored using JSON lists, saving a list of JSON objects within a single field in a single row of data in the Bubble database. This is to improve loading times of complex data, and also reduce the need for “do on a list of” workflows, which are painfully expensive (in workload consumption and speed) in Bubble right now.

It’s much more efficient to read and write one row of data than load 100. It’s also much more efficient to create and work with lists, versus creating tens or hundreds of child rows for a single parent row of data. I guess this is why no-SQL or document databases are popular in web development.

Writing JSON data, lists, etc. to a Bubble DB field is easy enough.

Reading JSON back into Bubble is a pain if you need the data in the correct types, like dates!

One workaround I could find was creating an API connector call to your app’s own API Workflows to read back your JSON object, and then setting the data types on the incoming JSON data from the API Connector.

But somehow it feels hacky.

It doesn’t seem to be how Bubble was intended to be used. It may also break more easily if you need to add fields or change JSON structures.

Any hot tips, ideas, or brainwaves??