Hi,
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"},
{"Task":"y"}
]
},
"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.
EDIT:
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
…/engine-rest/task/5381ce05-3210-11e6-b429-005056a54f10/variables/tasks
{
"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’”
}
EDIT:
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,
Michael