BDK Transformlist returning an Object

@gaurav (and anyone else who is familiar with the BDK plugin)…

Can a TransformList return an object? (and if so, do you have an example of how that might be done?) All of the examples in the documentation only show it returning text.

I’m trying to use a TransformList to return a slightly modified version of the list of objects that it is supplied.

In other words, I’d like to go from:

[
  { 
    prop1: a,
    prop2: b 
  },
 { 
    prop1: c,
    prop2: d 
  }
]

to

[
  { 
    prop1: a,
    prop2: b+n
  },
 { 
    prop1: c,
    prop2: d+n 
  }
]

Thanks in advance!

1 Like

Hi @spencer,

Bubble allows returning standard data types or data types (objects) defined in the bubble app’s Data tab. For the latter as output, simply select the object type in transformlist output and the return value specified in your code should be the unique id of the object.

In your provided example, if your source object lists as JSONs, you can simply provided the stringified item (i.e. list of texts), and in your code Json.parse → do the manipulation → Json.strinfigy → return the stringified text (i.e. output is also list of texts).

If you’re looking to use the output as objects, its’ not possible at the moment as bubble doesn’t allow on-the-fly object outputs. I’d love for bubble to provide that capability to plugin builders though. Infact it was my top feedback to their team last year on the plugin side.

Best,
Gaurav