Read json string array from postman

{
“messageName” : “startMsg”,
“businessKey” : “202033”,
“processVariables” : {
“Users” : {“value” : [“90007”,“960815”], “type”: “Json”}
}
}
I want to send the above json via postman to camunda (send an array of strings in the camunda variable). I read the information using the string variable according to the pattern below, but I need an array variable…
{Users.bpmn (4.6 KB)
“messageName” : “startMsg”,
“businessKey” : “202033”,
“processVariables” : {
“Users” : {“value” : “90007,960815”, “type”: “String”}
}
}

Hello @Forough

Try this:

{
   "messageName":"startMsg",
   "businessKey": "202033",
   "processVariables":{
      "Users":{
         "type":"Object",
         "value":[
            "90007",
            "960815"
         ],
         "valueInfo":{
            "objectTypeName":"java.util.ArrayList",
            "serializationDataFormat":"application/json"
         }
      }
   }
}

best regards

  • R
1 Like

Hi,Thanks for your help, but I got an error when i executing your code in postman
Source file:
Activities_parallelMultiInstance.bpmn (2.8 KB)

and pic error:

What changes do I need to make to get it running properly?

Hi,
I think the problem is that you defined the variable as a Form-Variable of the type “String”. Unfortunatelly it is not possible to choose Object for the form variable. Just remove it on the form. (You do not start your process from buit-in form anyway.) After your message is correlated I’ve got all variables from “processVariables” of your requrest.

I deleted the form variable but the same error is displayed again.(in postman)

Hallo,
I deployed and sucessfuly tested at my local engine. I did a small mistake. For postman you need to put the whole value in quotes and escape literal quotes, see below:

{
   "messageName":"startMsg",
   "businessKey": "202033",
   "processVariables":{
      "Users":{
         "type":"Object",
         "value": "[\"90007\",\"960815\"]",
         "valueInfo":{
            "objectTypeName":"java.util.ArrayList",
            "serializationDataFormat":"application/json"
         }
      }
   }
}

image
image

1 Like

@roman-mkh, @Forough variables(custom objects, Collection types, etc) type of Object needs serialization other than primitive types.

Thanks for your answer , i need to remove Users variable from form field and add send value in correct format ( “[“90007”,“960815”]” )