Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Automation - how to asJsonString quote a section?

In some previous steps, I perform a web request to Jira's API. The data I get back is okay.

{{#webhookResponse.body.issues}} | {{key}} | {{fields.summary}} | {{fields.customfield_12930}} | {{/}}

Now I want to provide this to a PUT to update a field:

"fields" : {
"description" : {{#webhookResponse.body.issues}} | {{key}} | {{fields.summary}} | {{fields.customfield_12930}} | {{/}}

 I need to asJSONString quote the {{#webhookResponse.body.issues}}...{{/}} section as wrapping in "" would break if the content includes quotes.

Neither {{#webhookResponse.body.issues.asJsonString}} or {{#webhookResponse.body.issues}}...{{/webhookResponse.body.issues.asJsonString}} works.

So how do I wrap {{#webhookResponse.body.issues}} in asJsonString?

This seems like an easy question... not sure why it's eluding me!

1 answer

To answer my own question, I believe it's possible to do this with list.join("\n").asJsonString

Jira smart values - lists | Cloud automation Cloud | Atlassian Support

I'll update when I get a chance.


bmccoy Atlassian Team Aug 22, 2022


Another option might be to use the Create Variable action.  Use that to build up the description text and then in the payload you can just treat it as a plain string e.g. {{newDescription.jsonEncode}}.

Also not sure if you are using the "Additional fields" on the edit issue action or sending a new web request, but if you are using the edit issue action you can just use the built-in description fields instead and it should handle all of that for you.


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events