Issue Processing Nested JSON Objects in "Schedule API Workflow on a list"

Title: Issue Processing Nested JSON Objects in “Schedule API Workflow on a list” for Variations

Description: I’m working on a Bubble.io project where I’m setting up an API workflow structure to create menu items and their variations from a JSON object. The JSON contains an array of objects representing menu items, and some of these items have a nested variations array with objects containing variation_name and variation_price (e.g., [{ “variation_name”: “klein”, “variation_price”: “€ 20” }, { “variation_name”: “gross”, “variation_price”: “€ 30” }]). My goal is to create each variation as a separate record in the “Variation” data type, linked to the corresponding menu item.

Current Workflow:

  1. read-Workflow: Calls the API and passes the JSON data to the “save”-workflow using a “Schedule API Workflow on a list” step on Request Data’s items.

  2. save-Workflow: Creates a new “Menu Category” and a new “Menu Item,” and if has_variations is set to “yes,” schedules a further “Schedule API Workflow savevariation on a list” step on This Request Data item’s variations.

  3. savevariation-Workflow: Creates a new “Variation” record with the parameters menu item, variationname, and variationprice.

Problem:

  • The variations data is passed as a single text string (e.g., “[{…}, {…}]”) instead of an array of objects to the “save”-workflow, causing the “Schedule API Workflow savevariation on a list” step to fail or not split the data correctly.

  • Attempts to use :formatted as text with a delimiter (:wink: produce a string like {“variation_name”: “klein”, “variation_price”: “€ 20”};{“variation_name”: “gross”, “variation_price”: “€ 30”}, but the workflow treats this as a single value, not a list.

  • The suggested expression This request data’s variationprice:Get item from list (index of Current cell in This request data’s variationname) is not available, as Bubble does not provide direct index access in this context, and a workaround with separate lists (variationname and variationprice) fails because the index mapping does not work.

  • Result: The “Variation” records store “Name” and “Price” as comma-separated strings (e.g., “klein, gross” and “€ 20, € 30”), instead of as separate entries.

    {
    “merchantid”: “1760706889197x714907637232557800”,
    “items”: [
    {
    “category”: “Minestre”,
    “name”: “Suppe1”,
    “description”: “Tomatencremesuppe mit Basilikumpesto und Sahnehäubchen”,
    “price”: “€ 4,80”,
    “allergens”: “A, G, H”,
    “has_variations”: “yes”,
    “variations”: [
    {
    “variation_name”: “klein”,
    “variation_price”: “€ 20”
    },
    {
    “variation_name”: “gross”,
    “variation_price”: “€ 30”
    }
    ]
    }
    ]
    }

    Expected Behavior:

    • Each variation should be created as a separate “Variation” record (e.g., Name = “klein”, Price = “€ 20” and Name = “gross”, Price = “€ 30”), linked to the menu item “Suppe1”.

    Tried Solutions:

    • Using This Request Data item’s variations directly without formatting results in an error, as it is interpreted as a text string.

    • :format as text with a delimiter produces a string that is not processed as a list.

    • Extracting variationname and variationprice as separate lists with :each item’s does not work, as the index mapping in the “save”-workflow fails (e.g., Get item from list is not available).

    Questions for the Community:

@Jici Any idea? Thank you man

Try using bulk create api call instead

1 Like

You’re already getting an array of objects, so your call is set up correctly. Just make sure the GET call’s “Use as” setting is set to Action, not Data, and then reinitialize it. Once that’s done, you can use the call inside your workflows in Bubble.

Go to the part of your app where you want to trigger the GET call, then add a new action. Search for the name of your GET call and select it. That will run the call and return your list of objects.

After that, add another action called Schedule API workflow on a list. Set the “Type of thing” to whatever the GET call returns, for example “Menu Item” or “API Menu Item,” depending on how your data is structured.

In the “List to run on” field, select “Result of step 1’s records” or “Result of step 1’s items,” whichever matches your response. I’m not sure what this will return for your use case, so let me know what options you have once you’ve set it to result of step 1 … we might have to split by a comma (,) as objects are separated using those rules…

And then of course, you set the API workflow field under the schedule api for list to be the api workflow that creates a new thing, which ultimately will create a new record for each object.

Let me know if you need more help.

From what I can see you should be able to figure out the rest.

So in summary the issue is the type of thing on your schedule api workflow savevariation on a list is not correct, it should not be set to text and the list to run is a natural extension of that problem.