Custom object as variables in task

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

“modifications”: {
“value”:"[{‘mailRecipient’:‘’,‘mailBody’:‘This is a test mail’},{‘mailRecipient’:‘’,‘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


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
javaSerializationFormatEnabled: true

Have you looked the documentation:

Yes…But that isn’t working for me.

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

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