How to create a JSON variable from Camunda script?

I know how to create a variable from the form using the createVariable with type: ‘JSON’;

How can I create this type of variable from a Listener script? Is it possible?

Thanks,
Leonardo

1 Like

@homer1980 you can use the S() function

https://docs.camunda.org/manual/7.7/reference/spin/json/

var json = S('....');
execution.setVariable('myJSON', json);
2 Likes

Hi Stephen, thanks a lot. Congratulations on your contributions to the Community.