External Task HashMap Dezerialization

Anyone knows how to deserialize in a External Task implementation a HashMap from variables?, in the next link you will get the problem description.

@christmo can you convert your hashmap to Spin Json instead? This would be more interop with other systems. Camunda even offers a Json conversion class for objects and arrays.

Thanks @StephenOTT, I was changed my javascript object to JSON and it works.

var vars = {};
vars.request_id = request_id;
vars.person_legal_type = “C”;
vars.person_legal_id = “12345”;
vars.natural_paternal_last_name = “Mora”;
vars.natural_first_name = “Christian”;

var proc = JSON.stringify(vars);
execution.setVariable(‘PROCVARS’, proc);

That works because you are saving your variable as a String. You might hit the 4000 character limit that is on a string Use SPIN (S(proc))
https://docs.camunda.org/manual/7.8/reference/spin/json/

1 Like