Getting http-connector response as collection instead of string

I have a service task with implementation of http-connector. I am able to get the response by properly passing in the url, method, headers etc. But the connector output is procured as ${response} which is by default a String. Say my response is a JSON and i want to immediately use eg:response.emailid in my next process task. With string it is not possible. Any way to achieve this or Is it possible. [I dont want to use a java delegate or code to do this task of converting JSON to collection]

1 Like

Hello my dear!

Try using this:

“S()” is a method from the SpinJSON lib to work with JSON objects!


Hope this helps. :slight_smile:

William Robert Alves

1 Like

Thankyou :slight_smile: . With this I am able to have my response assigned to variable “resp” as JSON. But still i cannot fetch the values inside the JSON with ‘.’ operator.

eg : name = ${resp.employeeName}
Unknown property used in expression: ${resp.employeeName}. Cause: Could not find property employeeName in class org.camunda.spin.impl.json.jackson.JacksonJsonNode [ start-instance-error ]

Any way to access the keys and values of the JSON with expressions.

hello my dear!

When you work with a JSON variable inside camunda through SpinJson, you can use the method. prop() to access each property within your JSON.

For example ${nameOfJsonVariable.prop("employeeName").stringValue()}

with this you will be accessing the variable, and looking for the value that is inside this JSON in the name property “employeeName” and returning this value as a String using the “stringValue()” method.

I hope this helps!

William Robert Alves

1 Like

It worked , thankyou so much :slight_smile: @WilliamR.Alves .

1 Like