Trouble with json arrays

so basically im trying to send an array i got sent from one source then make and rest api call to another source and having trouble sending the json to the second source i tried using the ${garmUrls.prop(‘urls’).elements()} but its returning an error…img going to attach all nessacary images so you can fully see whats going on

Screen Shot 2022-09-15 at 4.51.34 PM

Hi @Robert_Shaw ,

I guess you are trying to use the Spin API within script functions. So if your variable is already a json then you could write following:

${garmUrls.prop("urls").elements()}

According the stacktrace it seems that it currently is a simple string. Therefore you would need to adapt the expression to:

${JSON(garmUrls).prop("urls").elements()}

Documentation on this can be found here: JSON | docs.camunda.org

For accessing Spin you need to either already have a json/xml object or wrap them in one by calling one of S, XML or JSON. Then you can use spin methods. Available methods for JSON type can be found here: SpinJsonNode.java

Kind regards
Adagatiya

2 Likes