Hi,
I would like to extract individual fields from json stored in database. Is it possible?
There are several ways to do this, so it depends where it fits in your app …
In the API Workflow …
-
Use Bubble’s string processing functions. This can work okay for simple JSON with plain values.
-
Using the API connector Send it to an external server API which sends it back to you, and have the connector parse the JSON for you.
On a Bubble page, same methods as above, plus …
-
Toolbox plugin “Expression”
JSON.parse('
dynamic value').propertyname
This outputs a string, which you can then use in a text element or wherever. -
Toolbox plugin workflow step “Run javascript”
bubble_fn_myproperty(JSON.parse('
dynamic value').propertyname)
Then setup “Javascript to Bubble” to receive the value.
Thank you for your comprehensive answer
@mishav Thank you for this! Such a simple solution to such a common problem people are still encountering re: parsing/manipulating JSON on the front-end. Couldn’t be easier!