Passing variable to SubProcess as JSON Marshalled variable

Hi all,

I’m having a parallel multi-instance SubProcess in my bpmn. I’m passing 1 variable, which is the collection over which I iterate;

<bpmn:multiInstanceLoopCharacteristics camunda:collection="products" camunda:elementVariable="woProduct" />

This variable is a JSON-marshalled Java List. However when I take a look at the products or woProduct variables defined in the subProcess, I see they are java serialized objects instead;

Is there a way where I can force/alter this behavior?

Thank you.

Hi,

Thanks for reporting this behavior which is a bug in my opinion. I created a bug ticket: https://app.camunda.com/jira/browse/CAM-5760

What happens is that the JSON list variable is deserialized to a Java List, then the element is selected and set as a variable. When that variable is set, the engine tries to find a suitable serialization format which defaults to Java serialization. It does not use the format that the collection variable is serialized with, which is addressed by above ticket.

Let me know if you are interested in contributing a fix for this, should not be too hard.

Edit: A way to change the default choice is the engine configuration property defaultSerializationFormat that you can set to application/json.

Cheers,
Thorben

I added the defaultSerializationFormat to the engine configuration. That fixed it for now.

Unfortunately I do not have the time to contribute code-wise but as a believer of the pay it forward culture I will continue to contribute to this public forum wherever I can.

1 Like