I am trying to pass json payload in variables as value to start a process definition using engine-rest api as below:-
API:
Body :
{
  "variables": {
      "payload": {
        "value": {
            "mode": "email",
            "meta": [{
                "key": "topic",
                "value": "weather"
            }, {
                "key": "qos",
                "value": "2"
            }]
        },
        "type": "Json"
      }
  }
}
but it is giving 400 BAD REQUEST with below error:- Must provide 'null' or String value for value of SerializableValue type 'Json'.
Also i have used a expression in my BPMN process to fetch a key-value pair like below, it also throwing me error :-
${S(payload).prop("mode").stringValue() == 'email'}
Now working steps:- when i try to send body json payload in string format then it works fine.
API:
Body:
{
  "variables": {
      "payload": {
        "value": "{\"mode\": \"email\",\"meta\": [{\"key\": \"topic\",\"value\": \"weather\"},{\"key\": \"qos\",\"value\": \"2\"}]}",
        "type": "String"
      }
  }
}
same java code i am using here to fetch json payload-
public void notify(DelegateExecution delegateProcessExecution) throws Exception {
   Object notificationPayload =
       delegateProcessExecution.getVariable("payload");
    if (null != notificationPayload) {
        String notifyPayload = notificationPayload.toString();  
        JSONObject inputJson = new JSONObject(notifyPayload);
    }
    // ...
}
So i want this payload as json for whole process so that i don't need to convert it to string as above working example.