Hi Bubblers,
I’m struggling with what seems to be a common problem: displaying a list of JSON objects returned from an API inside a Repeating Group.
My Goal: My OpenAI API call (GenRec
) returns a JSON object inside the standard message content
field. I want to extract the empfehlungen
list from this JSON and display it in a Repeating Group.
My Setup:
- API Call (
GenRec
): The API successfully returns amessage content
(text) which contains the following JSON string:JSON{ "empfehlungen": [ { "karriereoption": "Datenanalyst", "match_empfehlung": "Die Nachfrage wächst...", "potenzial_aufwand": "Gehalt: 50-80k €..." }, { ... more objects ... } ] }
When I initialize the call, Bubble creates a response type calledGenRec choice
, which contains the fields “message role” and “message content” (holding the JSON string). - Custom State (
temp_json_antwort
):
- I have a custom state on my page.
- Its State type is set to
GenRec choice
. - The “is a list” checkbox is checked.
- Workflow:
- When a button is clicked, I run the
GenRec
API call. - In the next step, I use
Set state
to save the result. The value is set to:Result of step 1 (GenRec)'s choices
.
- Repeating Group (
RG_Empfehlung_Neu
):
- Its
Type of content
is set toGenRec choice
. - Its
Data source
is set toGroup_ChatContainer's temp_json_antwort
.
The Problem: My logic seems correct, but it’s not working. The core issue seems to be that Result of step 1 (GenRec)'s choices
is not a direct list of GenRec choice
objects. The actual list is “trapped” inside the message content
’s text string.
When I try to set the Data source
of a Text element inside the RG cell, I only see Current cell's index
. The option Current cell's GenRec choice
is missing, so I cannot access its fields.
What is the correct way to parse the JSON string from message content
and feed the empfehlungen
array to my Repeating Group? Do I need a plugin or a different approach in the workflow?
Here is a link to my editor (set to ‘everyone can view’).
Thank you for your help!