REST API - Start Process Instance with JSON

Hi,

We’ve been trying to use Start Process Instance REST API to send a JSON payload in a variable.

The JSON payload looks like

{
  "variables": {
    "json" : {
        "value" : 
				{
					"id": 0,
					"href": "string",
					"name": "string",
					"description": "string",
					"type": "string",
					"version": "string",
					"state": "Inactive",
					"serviceSpecification": 
					{
						"id": "string",
						"href": "string"
					}
				},
        "type": "string",
        "valueInfo" : 
        	{
        		"transient" : true,
        		"objectTypeName" : "CreateService",
        		"serializationDataFormat" : "JacksonDataFormatConfigurator"
    			}
    }
  },
 "businessKey" : "aaasc",
 "withVariablesInReturn": true	
}

The attribute “json” when reaches to first service task (JavaDelegate), becomes string

"value": "{id=0, href=string, name=string, description=string, type=string, version=string, state=Inactive, serviceSpecification={id=string, href=string}}",

How can we send the JSON string or probably some deserialized object (CreateService)?

Help or hints can help us to proceed in right direction :slight_smile:

Thanks,
Himanshu

Change your “type” to json, and send your json in as a escaped string for the value.

Hi @StephenOTT,

Appreciate your prompt reply.

We tried the method you’ve suggested, it worked but from client perspective sending escaped string for value seems a bit odd and ugly too.

Is there a way to kickoff deserialization procedure which would disable converting value as string and instead use our supplied one using Jackson? We were thinking of mapping it to a Java POJO.

Something similar to Spin examples.

Thanks,