Pass JSON to task variables and use in JUEL expression language


I do not find an explicit solution for passing and evaluation complex objects via the REST engine.

If I have following JSON which I pass as String

  "value" : {
      "task" : [{"Task":"x"},
  "type" : "String"

How can I pass this JSON into a process instance and the use this in the multi instance.
What is the correct approach? I merely want that for example “Task”:“x” is set in the first multi instance and “Task”:“y” is set in the second, so that my middle ware knows which multi instance task is for which concrete task.

I have tried to create a java class

public class Tasks {
    private Collection<String> tasks;

    public Collection<String> getTasks() {
        return tasks;

    public void setTasks(Collection<String> tasks) {
        this.tasks = tasks;

And then put a variable via REST

  "value" : "{\"tasks\": [\"test\", \"bar\"]}",
  "type" : "Object",
  "valueInfo" : {
    "objectTypeName": "de.vignold.wjt.Tasks",
    "serializationDataFormat": "application/json"

This returns 204. But asking for this variable returns:
“type”: “RestException”,
“message”: “Cannot get task variable tasks: Cannot deserialize object in variable ‘tasks’: SPIN/JACKSON-JSON-01007 Cannot construct java type from string ‘de.vignold.wjt.Tasks’”

It seems that Camunda has saved the JSON as a String and has not deserialized it to the object and therefore cannot serialize it back to json

if I click on “Deserialized”, I get the same error.

Is a Java class really necessary? I think otherwise, I won’t be able to evaluate the variable in the process engine?!

Best Regards,

Hi Michael,

I have successfully used json arrays using a classless process. I wrote up my example, you can find my write up in the blog post here (of course I may be a little biased…)

Heres an example of a set of documents I pass in via the REST API as a jso array…

{“POI” : {“value” : “[{“credentialType” : “Australian Birth Certificate”, “disposition”: “current”,“classification”:0,“expiryDate” : “2013-01-01T23:28:56.782Z”},{“credentialType” : “Australian Passport”, “disposition”: “Cancelled”,“classification”:0,“expiryDate” : “2012-01-01T23:28:56.782Z”},{“credentialType” : “Utility Bill”, “disposition”: “current”,“classification”:0,“expiryDate” : “2013-01-01T23:28:56.782Z”},{“credentialType” : “Utility Bill”, “disposition”: “current”,“classification”:0,“expiryDate” : “2013-01-01T23:28:56.782Z”}]”, “type” : “json”},
“SUBJECT” : {“value” : “{“givenNames” : “John Andrew”, “surname” : “Citizen”, “title” : “Mr”, “contact” : {“email” : "”,“mobile” : “0455555555”}, “residentialAddress” : {“suburb” : “Melbourne”, “state” : “VIC”, “postcode” : “3000”}, “DOB”:“01/01/1990”}", “type” : “json”},
“anotherVariable” : {“value” : true, “type”: “Boolean”}},
“businessKey” : “myBusinessKey”

Note the type is json, not String. In my multi-instance task, I can reference each element of the json array using this juel expression ${POI.elements()} in the multi-instance collection configuration. You also need to define the element variable which will be a json variable. Note the semantics are effectively pass by value…



1 Like

Hi Rob,

thx for the quick answer. I have tried it and I am some steps ahead now. Can you point me to your example code or at least tell me what you have defined as Element Variable?

I have now a variable "task" with a value "[\"test\", \"bar\"]"
My multi-instance UserTask is ${task.elements()}
And Element Variable is taskproc

Camunda is accepting it, but doesn’t pass the variable to the task instance. I expected two instances while instance one has variable taskproc = “test” and second taskproc = “bar”


I defined a variable called poi as the element variable (POI is the array) in the multi-instance task config. I then use input mappings config in modeler to map properties to a DMN table. Hence an example using juel is;


Hence this extracts the credentialType property as a string to pass to the decision table…



Ok, just realized that I need some experience with CallActivities also which were not passing the variables automatically. With your help it works now.

Many many thanks !! :slight_smile:

Hi Rob,

How did you use json type for dmn call . Can you please throw some light on it?