Parsing JSON to run recursive workflow

  1. I’m sending JSON to workflow A
  2. Workflow A is meant to parse the JSON out into it’s individual components (list of all names, list of all products, etc) and send to Workflow B.
  3. Workflow B recursively works through the list.

Issue is at step 2 where it isn’t parsing the JSON out correctly. In fact it doesn’t seem to use any of the original JSON data:

Set up of JSON being sent to workflow A:

Set up to parse JSON and send to workflow B:

Okay… so to be sure, you are aware that this is actually parsing your JSON.
But with Bubble limitations (what am I saying, all frameworks need to know what you’re parsing if you’re trying to read its inner-content), you must parse further if the level is higher than 1, (this term is called deep-nested objects/values) unless the object is identified by a thing within your application.

You’ll likely need to parse your strings after that as well to get the object.

Hope this helps.

I may be wrong, but is my data not only 1 layer down?

My Data:

As a reference point, I’m using this same technique (send JSON, then parse into a list in another workflow and it works fine).

Data input in working workflow:

How I’m processing the data in the working workflow (looks to be the same as the broken workflow):

@andrewmccalister - step 3 is definitely expecting list values? - looking at the ‘Shopify_variant_id’, did you reinitialize Step 2 correctly, as this should be a list right? - e.g. each item of ‘shopify_variant_id’.

@GH5T - interestingly, Bubble can parse JSON as nested objects. As a fun test, I went up to 5 nested lists and it was parsed correctly:

Initializing:

Using in Bubble:
request data

Example JSON if interested:

{
    "lis1": [
      {
        "id": 1,
        "list2": [
          {
            "id": 1,
            "list3":[
                {
                    "id": 1,
                    "list4": [
                        {
                            "id":1,
                            "list5": [
                                {
                                    "id":1,
                                    "text": "this is the final list"
                                }
                            ]
                        }
                    ]
                }
            ] 
          }
        ]
      }
    ]
  }  }
2 Likes

By step 3 I presume you mean ‘Workflow B’ from my initial post? If so, yes, it’s expecting a list - see screenshot below.

I’m a little confused by ‘looking at the ‘Shopify_variant_id’, did you reinitialize Step 2 correctly, as this should be a list right? - e.g. each item of ‘shopify_variant_id’.’ Can you rephrase? For clarity I’m wanting to send a list of Arrays, i.e […], […], […], …

It might only be a minor issue because your sending ‘each item’s Shopify_variant_id’ rather than the array of ‘each item’s Shopify _variant_id’s each item’ but this is probably just formatting it as a string “1235451,1241515” and you might need to parse this into a list within your follow on actions (split by “,”).

[
  {
    "Shopify_variant_id":[12314,12414]
  },
  {
    "Shopify_variant_id":[12314,12414]
  },
  {
    "Shopify_variant_id":[12314,12414]
  }
]

Seems like there are two issues here:

  1. Product, Image, Variant_ID not being parsed into lists
  2. Specifically the variant_id, being parsed as a string.

Are you thinking #2, is affecting #1?

Haha yeah youre right. Not sure what i meant but I thought he was trying to identify the nested data as a thing.

@andrewmccalister

Try outputting your data in console, then see if that json data matches what the example data looks like on their docs. If it does not have the same formatting it will not work.

Sometimes strings or objects can be parsed completely different than what is needed. Its always keen to double check your return and response values.

Edit: im actually facing the same issue on a library i am using, which needs perfect json data in order to render my output and will error out if its not right. Its frustrating but ill get it.

how do you output in the console?

There’s a few ways. I use my own plugin called BubbleEssentials - it has two options where you can console.log in the browser and console.log in the server.

Other means you’d have to implement yourself with javascript.

Oddly, I’ve just started having issues in separately workflows related to JSON parsing. These workflows have been working perfectly for months.

Json received into Workflow looks correct, but some of the data types (e.g categories and subcategories) aren’t being past to the next workflow on a list.

Not sure if these issues are connected but odd on the timing and both related to JSON parsing.


This could possibly be an error on Bubbles end. Try submitting a bug report.

Especially since other workflows are failing now.

Have you checked your latest production version (that hasn’t been updated yet)?

Reached out to customer support but it’s been 3 days since it got escalated.