Deserializing objects python

We have process variables stored as serialized Java objects. What is the proper way to grab and deserialize these to use in a python external task?

Hello @imLissy,

You can use the external task rest api to fetch and complete external tasks. Such api uses HTTP GET,POST and other request types for which you can use JSON in the body request while the engine’s response would be in JSON as well. Afterwards you could parse such JSON response, which would contain your process variables, using Python or any other language you might be using. In the previous links you will see how the request and response look like.

Regards,

@patozgg, I think the question was how to deserialize the serialized java object (application/x-java-serialized-object) value in the variables property, and maybe convert it to Python dictionary or something.

Found a solution:

import javaobj
import base64
b = base64.b64decode(task[‘variables’][‘objectVariable’][‘value’])
j = javaobj.loads(b)
print(j)