Hey everyone! 👋
I’m calling OpenAI’s API from FlutterFlow, and the response contains a JSON string inside choices[0].message.content
.
Here’s an example of the response I’m getting:
json
{ "choices": [ { "message": { "content": "{ \"ingredients_list\": \"Grapefruit juice (100%)\", \"harmful_ingredients\": \"\", \"beneficial_ingredients\": \"Vitamin C\", \"overall_evaluation\": \"100% natural, no additives\", \"isHealthy\": true }" } } ] }
🧩 What I did:
I set up the API call in FlutterFlow.
Used
$.choices[0].message.content
as the JSON path.Enabled Parse as Data Type and selected a custom
ApiResponseContent
data type I created with:json
{ "ingredients_list": "string", "harmful_ingredients": "string", "beneficial_ingredients": "string", "overall_evaluation": "string", "isHealthy": true }
The issue is:
Since content
is a stringified JSON, FlutterFlow is not parsing it into the defined data type — I can get the raw string but not access its internal fields like isHealthy
or ingredients_list
.
❓What’s the correct approach to parse and access the internal fields of a JSON string in FlutterFlow?
Should I use
Set from Variable
+ some custom logic?Do I need to create a
Custom Function
to parse the JSON manually?Or is there another trick for this?
Any help or pointers would be super appreciated 🙏
Let me know if you’ve handled something similar. Thanks in advance!APİAPapiapi