Hello everyone.
I wondered if it is mandatory when working with Camunda REST API to pass the arrays as Jackson (JSON) objects ?
Do I have to add to my .war a Java class foreach array that I use in my process ?
I just got an error like
{“type”:“ProcessEngineException”,“message”:“Cannot deserialize object in variable ‘subscriptions’: SPIN/JACKSON-JSON-01007 Cannot construct java type from string ‘array.Subscriptions’”}
Thanks a lot 
edit : additionally, I don’t know if the string from which process engine tries to get a Java type must be package.name.ClassName
No, you don’t need a Java class to back your JSON variable. In your REST request, you can set the variable type to json
instead of object
. Then you won’t have to supply any valueInfo
data and you will get what is called a native JSON value as documented here and here.
Edit regarding your edit
: For variables of type object
, the type name must be the full qualified class name, i.e. including package names.
Thanks for your answer. Do the JSON variable appear as JSON in cockpit ? I only see String process variables.
Maybe I’m missing some dependencies, even if I use pre-built Camunda docker image
A variable that can be successfully set should also be visible in Cockpit. Not sure if you can inspect the variable’s value, though.
I confirm I can’t inspect value for “Json” type.
I have a problem now : I can’t complete the “See business rules result” task in the BPMN here launchCancel.bpmn (34.8 KB)
The answer to my REST “complete task” call towards Camunda API is :
{“type”:“ScriptEvaluationException”,“message”:“Unable to evaluate script: SyntaxError: Invalid JSON: :1:0 Expected json literal but found <\n
\n^ in at line number 2”}’
I’ve put all my scripts inline to make the overview easier. I don’t know which script the problem is from, and why I have a
markup whereas I use only freemarker for payload and JS for answer mapping.
For instance, the “creditPayload” payload var for “create credit note” task is escaped JSON, with “” before the “:”.
Any idea ? Good afternoon 
Edit : when searching my process instance’s variables, I have the following value for the JSON I want to map as payload for my Credit note REST task :
The Json variable type now appears in Cockpit, it has been interpreted as Object as seen above. But I don’t know how to map it.
For now my freemarker is just “${creditPayload}” as you see in BPMN. But it does’t seem the correct syntax. What is the correct way to map the screenshot’s value in a JSON of same structure ?
Here is my POM if ever this is a dependency issue, but I’ve got the feeling it is a syntax issue. Thanks for reading
pom.xml (1.9 KB)