# 🔧 \[SOLVED\] How I received, modified, and resent a large JSON in Bubble using Toolbox & Backend Workflows

**URL:** <https://forum.bubble.io/t/solved-how-i-received-modified-and-resent-a-large-json-in-bubble-using-toolbox-backend-workflows/370077>\
**Category:** Content / Articles\
**Created:** [May 19, 2025, 10:32am UTC](https://forum.bubble.io/t/solved-how-i-received-modified-and-resent-a-large-json-in-bubble-using-toolbox-backend-workflows/370077 "2025-05-19T10:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![votterskog](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/votterskog/32/243952_2.png) [@votterskog](https://forum.bubble.io/u/votterskog)\
**Post date:** [May 19, 2025, 10:32am UTC](https://forum.bubble.io/t/solved-how-i-received-modified-and-resent-a-large-json-in-bubble-using-toolbox-backend-workflows/370077/1 "2025-05-19T10:32:41Z")

</div>

Hey Bubble community! I wanted to share a solution I finally cracked after 30+ hours of trial and error — in case it helps someone else out there struggling with JSON modification and external API workflows.

🧩 My challenge

I needed to:

1. **Receive structured JSON content** from an external API (in my case, Eventbrite),
2. **Modify** it — specifically update an image inside a nested object and bump the `page_version_number`, and
3. **Send** the modified version back to Eventbrite.

❌ What didn’t work

I initially set the API Connector to expect **JSON** as the response type. The problem? Bubble wouldn’t let me easily work with or re-use the entire JSON structure — especially when dealing with complex nested arrays and objects. Trying to pass this into toolbox (server script) didn’t work.

✅ The fix: Treat the response as **text** and process it manually

Here’s the key insight:

- **Set the response type to “text”** in the API Connector.  
 ![CleanShot 2025-05-19 at 11.31.27@2x](https://us1.discourse-cdn.com/bubble/original/3X/4/e/4e60bf874db7c15da82d8f4020c2fda97a559f5a.png)

- Save the response as a plain text field in your database or pass it straight into server script.

- Use **Toolbox’s “Run JavaScript”** in a backend workflow to parse, modify, and rebuild the JSON.

- Send the final result wherever you need — re-encoded as JSON.

🔍 The JavaScript I used in Toolbox (server-side action)

```auto
async function updateJson() {
    try {
        let json = JSON.parse(properties.thing1);
        let new_image_url = properties.thing2;
        let new_image_id = properties.thing3;

        // ✅ Update herocarousel image
        if (json.widgets && json.widgets[0]?.data?.slides[0]?.image) {
            json.widgets[0].data.slides[0].image.url = new_image_url;
            json.widgets[0].data.slides[0].image.image_id = new_image_id;
        }

        // ✅ Clean function
        function clean(obj) {
            if (Array.isArray(obj)) return obj.map(clean);
            if (obj && typeof obj === 'object') {
                const cleaned = {};
                for (const key in obj) {
                    if (
                        key === "resource_uris" ||
                        key === "resource_url" ||
                        key === "semantic_purpose" ||
                        key === "timed_display" ||
                        key === "display_restrictions" ||
                        (key === "id" && obj[key] === "")
                    ) continue;
                    cleaned[key] = clean(obj[key]);
                }
                return cleaned;
            }
            return obj;
        }

        // ✅ Keep only these widget types, and remove duplicate 'faq' if both exist
        const allowedWidgets = [];
        const widgetTypes = new Set();

        for (const w of json.widgets || []) {
            if (["herocarousel", "faqs"].includes(w.type) && !widgetTypes.has(w.type)) {
                allowedWidgets.push(w);
                widgetTypes.add(w.type);
            }
        }

        const cleanedJson = {
            access_type: json.access_type,
            purpose: json.purpose,
            modules: clean(json.modules),
            widgets: clean(allowedWidgets)
        };

        return JSON.stringify(cleanedJson);
    } catch (error) {
        return JSON.stringify({ error: error.message });
    }
}

updateJson();

```

 ![CleanShot 2025-05-20 at 04.39.13@2x](https://us1.discourse-cdn.com/bubble/original/3X/4/c/4cfc3ae5b695081fdf8c843fb27b9e36a5564cb2.png)

Why this works better

- By treating the original API response as **raw text** , you sidestep Bubble’s sometimes-too-strict JSON parsing.
- Toolbox gives you full JS power — no more nested “:extract with Regex” madness.
- Your backend stays clean, scalable, and debuggable.

 ![CleanShot 2025-05-20 at 04.35.37@2x](https://us1.discourse-cdn.com/bubble/original/3X/e/6/e66778c2829413784872dd27811c19cebc25b511.png)

I had to do a normal GET request to also be able to bump the version number. Other than that I posted the JSON body as a raw body back to eventbrite. All works fine.

**Bubble’s API Connector must receive structured content as text** , not JSON, if you want to parse and manipulate it. At least from the Eventbrite API as far as I can work it.

I tried sending it off to AWS Lambda, Make, and even Zerowork — nothing worked. It wasn’t until I discovered that I had to receive the JSON as raw **text** in the API Connector that things finally clicked. Thanks for reading, I hope it can help you with something.

---

<div class="post-metadata">

**Author:** ![randomanon](https://avatars.discourse-cdn.com/v4/letter/r/8491ac/32.png) [@randomanon](https://forum.bubble.io/u/randomanon)\
**Post date:** [May 20, 2025, 2:32am UTC](https://forum.bubble.io/t/solved-how-i-received-modified-and-resent-a-large-json-in-bubble-using-toolbox-backend-workflows/370077/2 "2025-05-20T02:32:28Z")

</div>

Let’s say you have a triple nested JSON:

- Countries  
– States  
— Cities

Do you create a dummy JSON response first then receive it as that data type? How would you actually display that in your elements?

---

<div class="post-metadata">

**Author:** ![votterskog](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/votterskog/32/243952_2.png) [@votterskog](https://forum.bubble.io/u/votterskog)\
**Post date:** [May 20, 2025, 3:25am UTC](https://forum.bubble.io/t/solved-how-i-received-modified-and-resent-a-large-json-in-bubble-using-toolbox-backend-workflows/370077/3 "2025-05-20T03:25:40Z")

</div>

If I understand you correctly.

- In your API connector use as data.
- Do a get request.
- On the element I think you’d choose “get data from an external API” response^country^state’s^city
