How to process nested JSON output coming from the API?

I have a nested JSON output that I receive from one of the API calls and I want to use the data to fill up my Bubble Data. The JSON file has a nested structure and I am using a Backend workflow to create entries in the Data. Due to the nested structure of the JSON, I am not able to create a mapping or relationship between the child data point and the parent data point. Here is an example of the JSON: [ { "review_text": "The view is really quite nice. Had trouble parking due to lack of parking space", "results": [ { "aspect": "view", "segment": "view is really quite nice", "sentiment": "positive" }, { "aspect": "parking", "segment": "Had trouble parking due to lack of parking space", "sentiment": "negative" } ] }]
I have 4 different Data tables, one for each field: ‘review_text’, ‘segment’, ‘aspect’ and ‘sentiment’. I somehow need to map ‘segment’, ‘aspect’ and ‘sentiment’ back to their parent which is “review_text”. I created a backend workflow that creates a new parent field (review_text) first and then within that backend workflow, I call a new backend workflow that iterates through the ‘results’ field and creates and maps the child fields ‘segment’, ‘aspect’ and ‘sentiment’. The issue is that I cannot pass the “results” field from the json as a value because it doesn’t match the data types from the dropdown. I also tried sending the “segments”, “aspects”, “sentiment” fields as a list of text, but Bubble doesn’t seem to treat those as a lists and treats is as text instead.

I wonder if there is a better way to solve this problem. Have any of you guys faced a similar problem or know how o solve this?


This topic was automatically closed after 70 days. New replies are no longer allowed.