Converting JSON to a list of things

I am using bubble as a checkout and want to pass the cart items (as they have nested values for subscriptions) as JSON whcih I have sone using base64 encoding and decoding but I’m having difficulty converting the json to a list of thing (with nested things) and save it to a state on the page so that it is faster than saving to the database.

Does anyone know how to convert a nested JSON into a list of things (with nested list of things)?
The array will look something like this…`

//  cart-items
    "purchased_bundle_count": 2,
    "purchased_bundles": [
        {
            "id": 1,
            "bundle_id": 3,
            "qty": 2,
            "bundle_items":[
                {
                    //Grass - Three weekly
                    "variant_id": 4
                },
                {
                    //PP - Black
                    "variant_id": 8
                }
            ]
        },
        {
            "id": 2,
            "bundle_id": 3,
            "qty": 1,
            "bundle_items":[
                {
                    //Grass - Weekly
                    "variant_id": 2
                },
                {
                    //PP - WHITE
                    "variant_id": 9
                }
            ]
        }

Screen Shot 2022-06-02 at 5.35.04 pm

I couldn’t figure out a way so I ended up running it through make.com(formerly integromat) and sending it back to bubble. Really would like a way to process it inside bubble.

1 Like

Where’s the json come from?
You could consider using a plugin to create a json file and use Bubble API Connector to get this files and let Bubble parse the JSON.
However, actually this JSON is not correct (you can use jsonhint to check it)

1 Like

Thanks for your response, yes I know the json here is not correct it’s just an example. We’re creating a nodejs api instead.

You could run it through the api connector.
Set up a call in the api connector by setting up a backend api workflow that accepts text then call that from the api connector.

1 Like

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