Setting Object variables from Tasklist or REST API

I am using Camunda Platform 7.19.0. I am trying to set an Object variable from Task list or from the REST API. For example, when I try to create an ArrayList variable from like this

PUT /process-instance/aProcessInstanceId/variables/aVarName
{
  "value" : "[1,2]",
  "type" : "Object",
  "valueInfo" : {
    "objectTypeName": "java.util.ArrayList",
    "serializationDataFormat": "application/xml"
  }
}

I get this error in cockpit

I also tried to set it in Tasklist like this but I am not sure what to type here

I have already added camunda-engine-plugin-spin in Gradle dependencies. I have checked the documentation about serialization/deserialization, but I am still confused about how to set Object variables.
Any help would be appreciated.

Thanks.

@cambarantama Refer this page:

Does the object type name have to be a POJO? I am trying something like an ArrayList like this

{
  "value" : "[\"item1\", \"item2\", \"item3\"]",
  "type" : "Object",
  "valueInfo" : {
    "objectTypeName": "java.util.ArrayList",
    "serializationDataFormat": "application/json"
 }

but it deserialization keeps failing.

From the docs: To retrieve the serialized form of a variable, use the deserializeValues=false GET parameter.

@cambarantama , In previous example you’ve used xml as serializationDataFormat and the below example you’re using JSON.

Which serializationDataFormat you’re actually looking for?

Here are the supported variable types: