# JavascriptToBubble - way to bring data back as User instead of text

**URL:** <https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462>\
**Category:** Questions\
**Created:** [September 21, 2018, 6:33pm UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462 "2018-09-21T18:33:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kramwe](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kramwe/32/10102_2.png) [@kramwe](https://forum.bubble.io/u/kramwe)\
**Post date:** [September 21, 2018, 6:33pm UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462/1 "2018-09-21T18:33:44Z")

</div>

Hi. Anyone know how to load data in from JavascriptToBubble as Value type = User? I’ve always brought the data back as text

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/2/7/27b9c8713f552a7e78214d1bbcb2fd5250d3a0de.png)

---

<div class="post-metadata">

**Author:** ![mattmazzega](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mattmazzega/32/14401_2.png) [@mattmazzega](https://forum.bubble.io/u/mattmazzega)\
**Post date:** [September 21, 2018, 8:15pm UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462/2 "2018-09-21T20:15:25Z")

</div>

Hi,

You have to return a user unique\_id, so it will automatically considered it as a user.  
It allows you to skip the extra step of doing a search for a user where unique\_id = your javascripttobubble’s text

---

<div class="post-metadata">

**Author:** ![kramwe](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kramwe/32/10102_2.png) [@kramwe](https://forum.bubble.io/u/kramwe)\
**Post date:** [September 21, 2018, 8:17pm UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462/3 "2018-09-21T20:17:10Z")

</div>

So, ‘{“unique\_id”: “bubble user\_id”}’?

Do you know if it can include more than just the unique\_id?

For example, unique\_id and user\_first\_name and user\_last\_name?

---

<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:** [September 21, 2018, 9:09pm UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462/4 "2018-09-21T21:09:26Z")

</div>

No, what @mattmazzega is saying is this: Here’s a very simple example. On my page:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/d/a/da31f29a0b027084ed53edda1043427b6dc4d4d8.png)

When a complex data type is selected as the JS to Bubble’s type, you can feed it a thing by sending it the `:unique id` of a thing of that type and it will fetch that thing.

So, in this example, when we click the Who Am I? button, we will execute bubble\_fn\_user and pass it a User’s unique ID as a string. We’ll just use Current User in this example. Here’s the workflow:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/f/5/f51c519303d6e1632864fa9f94082253a4fbc60e.png)

^^^ note the quotes - we have to qoute delimit the Bubble part or else we’ll get a syntax error. These can be single or double quotes, depending upon your preference.

In Run mode we see:

![image](https://us1.discourse-cdn.com/bubble/original/3X/4/f/4f51b69f39f03327701c83759b57fbd46e5be9dd.png)

And when we click the button:

![image](https://us1.discourse-cdn.com/bubble/original/3X/6/d/6d131e0d5f05dab6f9ba4854e4fc7cd9ef0a691e.png)

The JavaScript to Bubble’s value contains an actual User object and we can access all parameters that are allowed.

BTW, @mattmazzega, _I didn’t know about this feature of JS to Bubble!_. Thanks for pointing it out! So cool… (So thanks.)

---

<div class="post-metadata">

**Author:** ![mattmazzega](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mattmazzega/32/14401_2.png) [@mattmazzega](https://forum.bubble.io/u/mattmazzega)\
**Post date:** [September 22, 2018, 8:15am UTC](https://forum.bubble.io/t/javascripttobubble-way-to-bring-data-back-as-user-instead-of-text/38462/5 "2018-09-22T08:15:46Z")

</div>

@keith You’re welcome! In fact, I found that quite recently too 🙂
