How do I return arrays/lists form Scriptable to Shortcuts?

I’m trying to get Shortcuts to recognize javascript arrays as list but to no avail.

Example:

var data = [1,2,3]
Script.setShourtcutOutput(data)
Script.complete() 

Shortcut receives this as a string "[1,2,3]" instead of a list with 3 items.

For now, my workaround is:

var data = [1,2,3]
Script.setShourtcutOutput( {res: data} )
Script.complete() 

…which gets interpreted correctly as a dictionary so I can grab the value of res which gets identified as a list.

In case anyone’s interested, here’s Simon’s reply over twitter

I’m afraid that I don’t have a better workaround than the one you suggest. Outputting arrays isn’t properly supported (yet) since there seem to be a bug in Shortcuts that causes the app to crash when an action returns a list.