Javascript client returning object to bubble : what format?

Hello,
I’d like to know how to format a Client Javascript returned object to bubble to make sure it matches the same structure as a “Type” in the bubble database.
for example, I have a type of “Myobject” with the following fields :

  • item1 as text
  • item2 as text
  • item3 as text.

In my Client Javascript I run an Http request and some code that gives one single value for each “item”, like :

  • item1=“this is my value for item1”;
  • item2=“this is my value for item”;
  • item3=“this is my value for item3”;

when I try to link my Client Javascript code to bubble by finishing my code with bubble_fn_mydata(item1:item1,item2:item2,item3:item3) data will not show up, even if I’ve checked that the “javascript to bubble” component has the correct format of MyObject.

I have also tried to create the MyObject forst, and then send it back, like the below :
MyObject={item1:item1,item2:item2,item3,item3}
and then send it back to bubble with :
bubble_fn_mydata(MyObject);

None of these solution work. No error message, but no data is transfered to bubble so that I can display them into Text components.

Console.log(MyObject) gives :
{item1:“this is my value for item1”, item2:“this is my value for item2”,item3:“this is my value for item3”}

Which seems ok to me, but I might be wrong somewhere ?

Thansk for some guidance on how to format this CLient Javascript code so that Bubble can capture it properly.
Thanks,
Laurent.

I found an uggly solution as a workaround : In the Client Javascript code I create a list of items instead of an object :

  • Item_List[0] = “this is my value for Item1”
  • Item_LIst[1]=“this is my value for Item2”
  • Item_List[2]=“this is my value for Item3”

Then I pass this list of item back to bubble through : bubble_fn_MyItems.

Back on the Design part, I link Text elements to this Javascrip-to-Bubble by using the list with appropriate index item1 → [1], item2 → [2], item 3 → [3].

Not perfect, but it works.

Digging up older threads to provide an answer for future bubblers. Check out how to do this here!