Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JSON formattable sub task list in Webhook

Ram
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 23, 2021

I have created an outgoing webhook from Jira and would like to pass the subtasks list with summary and status fields. No matter what I do, the JSON parse doesn't work in my target app.

 

With the below, if there are more than 1 subtask, JSON deserialization expects a comma at the highlighted (Line 8).

{
    "key": "{{issue.key}}",
    "subtasks": [
    {{#issue.subtasks}}
        {
            "summary": ""{{summary}}",
            "status": ""{{status.name}}"
        }
    {{/}}
    ]
}

 

If I add the comma at Line 8, after the subtasks are finished iterating, JSON expects no comma. 

1 answer

1 accepted

1 vote
Answer accepted
Ram
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 23, 2021

Able to resolve the issue by using {{^last}},{{/}}

 

{
"key": "{{issue.key}}",
"subtasks": [
{{#issue.subtasks}}
{
"summary": ""{{summary}}",
"status": ""{{status.name}}"
}
{{^last}},{{/}}
{{/}}
]
}

Suggest an answer

Log in or Sign up to answer