# Unable to send array with multiple objects from Javascript to bubble element

**URL:** <https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315>\
**Category:** Plugins\
**Created:** [February 1, 2024, 10:53am UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315 "2024-02-01T10:53:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paresh.kalekar](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@paresh.kalekar](https://forum.bubble.io/u/paresh.kalekar)\
**Post date:** [February 1, 2024, 10:53am UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/1 "2024-02-01T10:53:06Z")

</div>

I want to send an array from toolbox\_javascript using bubble\_fn to a bubble repeating group element but get below error

Array I want to send from Run\_Javascript to repeating group

```auto
[
    {
      "name": "Independent Method Claim",
      "code": "graph TD; A[Detecting Movement] --> B[Generating a digital content based on movement]; B --> C[Digital content represents text and/or drawings];"
    },
    {
      "name": "Dependent Method Claim",
      "code": "graph TD; A[Generating a speech description of content];"
    }
  ]

```

Error that I received in console

```auto
run_debug.js:725 Element JavascripttoBubble A - The plugin Toolbox / element Javascript to Bubble threw the following error: Error: Expected a string, but got a object (original data: {"name":"Independent Method Claim","code":"graph TD; A[Detecting Movement] --> B[Generating a digital content based on movement]; B --> C[Digital content represents text and/or drawings];"})
    at generate_JS_to_bubble_error (https://patent-my-idea-4.bubbleapps.io/package/run_debug_js/25e47a0c4ecc1910e6b19485b33cbb574831925a786a5d0c20a36a39966814d6/xfalse/x25/run_debug.js:607:22675)
    at Object.JS_to_bubble (https://patent-my-idea-4.bubbleapps.io/package/run_debug_js/25e47a0c4ecc1910e6b19485b33cbb574831925a786a5d0c20a36a39966814d6/xfalse/x25/run_debug.js:608:3068) (please report this to the plugin author)

```

Can someone help with this issue?

---

<div class="post-metadata">

**Author:** ![Baloshi69](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/baloshi69/32/136122_2.png) [@Baloshi69](https://forum.bubble.io/u/Baloshi69)\
**Post date:** [February 1, 2024, 11:10am UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/2 "2024-02-01T11:10:28Z")

</div>

As you read in your error its expecting and String but getting an object, try to look the type you set in the FN element on page level what is it.

---

<div class="post-metadata">

**Author:** ![paresh.kalekar](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@paresh.kalekar](https://forum.bubble.io/u/paresh.kalekar)\
**Post date:** [February 1, 2024, 1:19pm UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/3 "2024-02-01T13:19:03Z")

</div>

@Baloshi69

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/b/f/bf6aaa815992e5387d00f80cf52658c378c870eb.png)  
I have set it as **‘text’**

To give a full picture of what I am trying to achieve is, I am making an API call which gives me below response and I want to fetch and pass the ‘ **flowcharts** ’ array value into repeating group from javascript

```auto
{
  "claims": "1. A pen comprising: a sensor configured ...",
  "flowcharts": [
    {
      "name": "independent_method_claims",
      "code": "graph TD; A[Start] --> B[Detecting pen movement]; B --> C[Generating digital content based on detected movement]; C --> D[Generating speech description of digital content]; D --> E[End]"
    },
    {
      "name": "dependent_method_claims",
      "code": "graph TD; A[Start] --> B[Storing the digital content]; B --> C[Wirelessly communicating the digital content to remote device]; C --> D[Converting detected movement into digital format]; D --> E[Adjusting speech description based on user settings]; E --> F[End]"
    }
  ]
} 

```

**Javascript code**  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/6/1/610eb7b5df93788e0d59f1650dc0330c229efefd.png)

---

<div class="post-metadata">

**Author:** ![Tetrev](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tetrev/32/132497_2.png) [@Tetrev](https://forum.bubble.io/u/Tetrev)\
**Post date:** [February 15, 2024, 5:29pm UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/4 "2024-02-15T17:29:44Z")

</div>

Have you been able to solve it?

---

<div class="post-metadata">

**Author:** ![paresh.kalekar](https://avatars.discourse-cdn.com/v4/letter/p/bcef8e/32.png) [@paresh.kalekar](https://forum.bubble.io/u/paresh.kalekar)\
**Post date:** [February 19, 2024, 5:41am UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/5 "2024-02-19T05:41:25Z")

</div>

No, I am unable to find any solution.

However, I have discovered a workaround for my specific problem. My app is on a paid plan, which enables me to utilize **Bubble APIs**.

So, now I am calling the Bubble API in **RunJavascript** and sending the array value to the backend workflow, where the API detects data. From there, I am saving the value in a database, which I then display in my frontend.

---

<div class="post-metadata">

**Author:** ![Tetrev](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tetrev/32/132497_2.png) [@Tetrev](https://forum.bubble.io/u/Tetrev)\
**Post date:** [February 19, 2024, 7:04am UTC](https://forum.bubble.io/t/unable-to-send-array-with-multiple-objects-from-javascript-to-bubble-element/305315/6 "2024-02-19T07:04:20Z")

</div>

I was finally able to solve it as well. I modified my object in javascript to single dimensional array - values are delimited by special symbols. Then I sent this list to bubble using bubble\_fn\_list function. Now I can show the list in a repeating group and extract the values using regex in each column.  
I was able to find this solution thanks to this comment [How to use Javascript in bubble - #6 by exception-rambler](https://forum.bubble.io/t/how-to-use-javascript-in-bubble/221960/6)
