JSON variables strategy

As I understand Flowable supports JSON tyle process instance variables. That variable type is made by HTTP Task when related property is set to True. It’s convinient for ${object.nodename} notation in expressions and for collection-initiated multi-instance flows. JSON variable also returns JSON text form via API and Admin app.

I figured out how to create such variable type in JS script:

var JsonNodeFactory = new com.fasterxml.jackson.databind.ObjectMapper
 
var myJson= [{"value":"1"}, {"value":"2"}];
 
execution.setVariable('myCollection',  
ObjectMapper.readTree (JSON.stringify(myJson)));

Is my approach correct?

I also don’t know how to use existing JSON variable in JS script to modify the object, extract node values, etc. Could anybody toss me any example?