# How to transform Bubble list into a Javascript Array

**URL:** <https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603>\
**Category:** Need help\
**Created:** [April 9, 2021, 7:02pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603 "2021-04-09T19:02:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [April 9, 2021, 7:02pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/1 "2021-04-09T19:02:18Z")

</div>

Hi! I am using the Toolbox to save an array into an object in Bubble (as a list).

The problem is that the array is something like:

**[“Car”, “Plane”, “Boat”]**

And the list is something like:

**Car, Plane, Boat.**

So when i try to read this list back into my workflow, and transform it into an array, it became a single element such:

**[“Car, Plane, Boat”]**

How can i put this list back into javascript and make it understand that every single element in the list is an element in my array?

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [April 9, 2021, 7:11pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/2 "2021-04-09T19:11:15Z")

</div>

You use JavaScript to Bubble, of course to return your JavaScript array to Bubble. Configure your JS to Bubble as a list of texts type.

When you call its function from Run JavaScript, you pass your (properly formatted) JavaScript array as its argument.

---

<div class="post-metadata">

**Author:** ![rpetribu](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rpetribu/32/90852_2.png) [@rpetribu](https://forum.bubble.io/u/rpetribu)\
**Post date:** [April 9, 2021, 7:22pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/3 "2021-04-09T19:22:05Z")

</div>

Hi @keith .

I am having no problem with this. The problem is to make my javascript read back the list that i have stored in the “JavaScript to Bubble” element as an Array, because it was saved as a list.

But i have found a solution 🙂 …

`var lista = ["my_list's value list:items from #1 join with ",""]`

This JavaScript converts the list into an array format.

Thanks!!

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [April 9, 2021, 9:14pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/4 "2021-04-09T21:14:21Z")

</div>

Yep, that’s how you do that. (I guess I read your question backward, eh, @rpetribu?)

Note that don’t actually need the `:items from #1` operator here as, by default, the text representation of this list will be all items, by default. (But you do need the :join, obviously, as the default join is comma-space, not quote-comma-space.) Whenever you’re constructing an expression like this, it’s helpful to first throw it into a text element so you can see what you’re building.

The way that Run JavaScript works is that it just runs JavaScript’s eval() function on the contents of the text input. So you’re literally just constructing the text of your script. Any Bubble expressions you write in that text input are evaluated by Bubble and spit out as text.

(This evaluation happens “right before” your workflow executes the Run JavaScript action – the input field is evaluated and that fully expanded string value is what is sent to the guts of the Run JavaScript action. Which just runs eval() on that string.)

---

<div class="post-metadata">

**Author:** ![mcllvz](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mcllvz/32/126939_2.png) [@mcllvz](https://forum.bubble.io/u/mcllvz)\
**Post date:** [April 15, 2021, 8:01am UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/5 "2021-04-15T08:01:16Z")

</div>

Uff 🔥

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [June 18, 2021, 7:03pm UTC](https://forum.bubble.io/t/how-to-transform-bubble-list-into-a-javascript-array/145603/6 "2021-06-18T19:03:15Z")

</div>

Closed on June 18, 2021, 7:03pm UTC

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