# Transferring an Object from a Plugin to Bubble

**URL:** <https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069>\
**Category:** Plugin builders\
**Created:** [January 19, 2025, 5:31pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069 "2025-01-19T17:31:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![frederic.mosland](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@frederic.mosland](https://forum.bubble.io/u/frederic.mosland)\
**Post date:** [January 19, 2025, 5:31pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/1 "2025-01-19T17:31:09Z")

</div>

Hi,

In my Bubble app, I’ve created a type in the API Connector called “bubble-zone” with the following structure:

{ “id”: 1, “name”: “test”, “color”: “#54df65” }

In my plugin, I have a field called `zone-data-type` of type “App Type”, and an exposed state `array_of_zones` of type `zone-data-type`.

When I try to pass my `zone` object from the plugin to Bubble, a new item is created in my state, but the properties (`id`, `name`, `color`) are empty.

Here’s the code used in the plugin:

const zoneData = { “id”: 1, “name”: “test”, “color”: “#FFFFFF” }; instance.publishState(‘array\_of\_zones’, [JSON.stringify(zoneData)]);

I’ve spent the whole day trying to solve this, but I can’t find any information on how to proceed or if there’s a specific structure I need to use for the object.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![DjackLowCode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/djacklowcode/32/222536_2.png) [@DjackLowCode](https://forum.bubble.io/u/DjackLowCode)\
**Post date:** [January 19, 2025, 10:06pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/2 "2025-01-19T22:06:56Z")

</div>

> [@frederic.mosland](#):
>
> `color`

Is the object in the app or the plugin? because the approach you take will be slightly different.

have a look through this article: [https://lunchpaillabs.com/blog/working-with-virtual-data-types-in-bubble](https://lunchpaillabs.com/blog/working-with-virtual-data-types-in-bubble)

---

<div class="post-metadata">

**Author:** ![frederic.mosland](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@frederic.mosland](https://forum.bubble.io/u/frederic.mosland)\
**Post date:** [January 19, 2025, 10:34pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/3 "2025-01-19T22:34:42Z")

</div>

> [@DjackLowCode](#):
>
> ou take will be slightly different.

thx  
The object is created in the plugin and have to be passed to the app

---

<div class="post-metadata">

**Author:** ![DjackLowCode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/djacklowcode/32/222536_2.png) [@DjackLowCode](https://forum.bubble.io/u/DjackLowCode)\
**Post date:** [January 19, 2025, 10:42pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/4 "2025-01-19T22:42:17Z")

</div>

> [@frederic.mosland](#):
>
> const zoneData = { “id”: 1, “name”: “test”, “color”: “#FFFFFF” };

Then the updated code would be

const zoneData = { “\_p\_id”: 1, “\_p\_name”: “test”, “\_p\_color”: “#FFFFFF” };

It needs to have the `"_p_"` prefix for plugin types

---

<div class="post-metadata">

**Author:** ![frederic.mosland](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@frederic.mosland](https://forum.bubble.io/u/frederic.mosland)\
**Post date:** [January 19, 2025, 11:12pm UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/5 "2025-01-19T23:12:26Z")

</div>

Thanks for your reply, but it still doesn’t work. I must have missed something else.

---

<div class="post-metadata">

**Author:** ![tim12333](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/tim12333/32/260227_2.png) [@tim12333](https://forum.bubble.io/u/tim12333)\
**Post date:** [January 20, 2025, 12:10am UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/6 "2025-01-20T00:10:29Z")

</div>

Make sure you’re passing an object (in your example you have JSON.stringify which will pass your object as a single string)

And then @DjackLowCode was right on the money, make sure you use the `"_p_"` prefix

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [January 20, 2025, 4:47am UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/7 "2025-01-20T04:47:18Z")

</div>

The prefix for API Connector data is `_api_c2_`. `_p_` is used for Bubble datatypes.

---

<div class="post-metadata">

**Author:** ![DjackLowCode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/djacklowcode/32/222536_2.png) [@DjackLowCode](https://forum.bubble.io/u/DjackLowCode)\
**Post date:** [January 20, 2025, 6:00am UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/8 "2025-01-20T06:00:50Z")

</div>

For reference in the plugin (e.g. a datatype created in the Apiconnector - within the plugin), these can be created in the code using the ‘_p_’ prefix - maybe both _api\_c2_ can be used in this case? 🤔

---

<div class="post-metadata">

**Author:** ![ihsanzainal84](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ihsanzainal84/32/245932_2.png) [@ihsanzainal84](https://forum.bubble.io/u/ihsanzainal84)\
**Post date:** [January 20, 2025, 7:14am UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/9 "2025-01-20T07:14:09Z")

</div>

Switching to `_api_c2_` fixed a similar issue for me in my plugin.

I think I better clarify. If the resulting state App Type is an API Connector datatype, you’ll need to use the api prefix. Both API Connector and DB datatypes are selectable as a plugin “App Type” but the plugin must attach the right prefix accordingly. I just use a boolean in my plugin.

---

<div class="post-metadata">

**Author:** ![frederic.mosland](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@frederic.mosland](https://forum.bubble.io/u/frederic.mosland)\
**Post date:** [January 20, 2025, 7:33am UTC](https://forum.bubble.io/t/transferring-an-object-from-a-plugin-to-bubble/356069/10 "2025-01-20T07:33:11Z")

</div>

Thx a lot !  
It finally works.  
That was the only thing I hadn’t tried yet 🙂
