Custom object as variables in task

Hi,
I have a user task and I want to set variables through RestAPI.
This is my payload.

{
“modifications”: {
“email”:{
“type”:“Object”,
“value”:“[{‘mailRecipient’:‘abc@xyz.com’,‘mailBody’:‘This is a test mail’},{‘mailRecipient’:‘xyx@xyz.com’,‘mailBody’:‘This is a test mail 2’}]”,
“valueInfo”: {
“serializationDataFormat”: “application/x-java-serialized-object”,
“objectTypeName”: “com.domain.EmailRequest”
}
}
}
}

and I’m using this ReST API

http://localhost:8080/rest/engine/default/task/db92739d-e5da-11e9-9e63-00155dff6b03/variables.

I am getting below error.

Cannot modify variables for task db92739d-e5da-11e9-9e63-00155dff6b03: ENGINE-17007 Cannot set variable with name email. Java serialization format is prohibited

Also where should i set javaSerializationFormatEnabled true?
I have tried to set it in my yaml file as
camunda.bpm:
application:
javaSerializationFormatEnabled: true

Have you looked the documentation:
https://docs.camunda.org/manual/latest/user-guide/process-engine/variables/#object-value-serialization

Yes…But that isn’t working for me.

As you know Camunda provides another option, Spin. Have you explored this.

https://docs.camunda.org/manual/latest/reference/spin/extending-spin/#configuring-data-formats

I want to set the task variables.I see no Spin Documentation for it.