Error: SPIN/JACKSON-JSON-01006 Cannot deserialize


I got error below:

`Cannot submit task form b16335d9-af77-11eb-a577-561dc61868be: Cannot deserialize object in variable 'pdcEvaluationGroup': SPIN/JACKSON-JSON-01006 Cannot deserialize '[{"id":"ok...' to java type '[collection type; class java.util.ArrayList, contains [simple type, class com.mobven.camunda.identity.model.AuthUser]]'`
  • Actually, I created the pdcEvaluationGroup variable second activity in the model which stored a list of users coming from the camunda identity service.
  • I assign the same task to each user and get a result from them in this list. (think like voting);
  • After that gateways and another task works. But almost 3 activities later, I got this error. When I checked the cockpit you can see screenshots below, type is Object, not deserialize.
    *When I change the type to JSON, the error went out but I want to use this variable again in the next steps. At that point, I got another error which says it is not a collection.

So I checked docs but still confused about the issue.

1 Like

@Oktay_Ibis You can change the serialized Json string to collection like below:

SpinJsonNode spinJsonNode = Spin.JSON(execution.getVariable("pdcEvaluationGroupJson"));

//If the list values is type of primitives:
List<String> pdcEvaluationGroup = spinJsonNode.mapTo(List.class);

//If type is custom object, and the java class doesn't exist in the classpath:
List<String> usersList = new ArrayList<>();
usersList.add(spinJsonNode.jsonPath("username").stringValue());  //extract username from the array

//If type is custom object, and the java class exist in the classpath:
List<AuthUser> pdcEvaluationGroupList = spinJsonNode.mapTo(List.class);
List<String> usersList = new ArrayList<>();

Now use this variable β€œpdcEvaluationGroup” as the collection variable for assignments.

Refer the below example:

BPMN File: voting.bpmn (3.7 KB)

External Worker configuration which sets the variable votersListJsonValue as serialized json value with type as Json:

public class VotersPreparationWorker {

	private Gson gsonParser;

	private ExternalWorkerConfiguration externalWorkerConfiguration;

	public void handleExternalTasks() {"Initialzing the ExternalTaskServiceWorker with configuration:{}", externalWorkerConfiguration);

		ExternalTaskClient externalTaskClient = ExternalTaskClient.create()
				.addInterceptor(requestContext -> requestContext.addHeader("Authorization",

		TopicSubscription topicSubscription = externalTaskClient.subscribe("FETCH_APPROVERS")
				.handler((externalTask, externalTaskService) -> {
					List<Voters> votersList = new ArrayList<>();
					JsonValue votersListJsonValue = ClientValues.jsonValue(gsonParser.toJson(votersList));

					Map<String, Object> variables = new HashMap<>();
					variables.put("votersListJsonValue", votersListJsonValue);

					externalTaskService.complete(externalTask, variables);"ExternalTask {} with businessKey {} completed!!!", externalTask.getId(),

				}).lockDuration(30000).open();"ExternalTaskServiceWorker has subscribed to the topic {} sucessfully",


Voter object which i kept part of the external task worker.

public class Voters implements Serializable {

	private static final long serialVersionUID = 1L;
	private String username;
	private String email;
	private String city;
	private int age;
	private String uniqueId;
	private boolean allowedToVote;


Now, the Voters object doesn’t present in the process application and I have the serialized json value for the list of Voters object.

I have configured the below Execution listener(PrepareVotersListListener) to the event type β€œtake” for the outgoing sequence from external task.

Now extracting the users list will be like:

public class PrepareVotersListListener implements ExecutionListener {

	public void notify(DelegateExecution execution) {"Executing PrepareVotersListListener.....");
		SpinJsonNode spinJsonNode = Spin.JSON(execution.getVariable("votersListJsonValue"));
		List<String> votersList = new ArrayList<>();
		spinJsonNode.elements().forEach(elem ->{
			String username = elem.jsonPath("username").stringValue();"Username of the voter:{}", username);
		execution.setVariable("votersList", votersList);


For using SpinJsonNode make sure below dependencies are in the classpath of process apllication:





JSON Value inserted from worker for the Voters object like:

From process application, using spinnode the extracted users list value looks like:

Cockpit view of the process history:

1 Like