I am trying to add a label when creating a Jira ticket.
The label is based on a variable that is calculated on the previous module:
The next module is an HTTP module to create a Jira ticket. Everything works fine except the label, which bring a JSON error.
I get the following error:
Any ideas? I tried everything (removing / adding quotes, double brackets etc)
the JSON parsing error is because Jira’s API expects the "labels" field to be an array of strings, but in your request body it looks like the priorityLabel variable is being passed without quotes, which makes it invalid JSON when inserted.
Right now your snippet looks like this in Make:
"labels": [ {{priorityLabel}} ]
If priorityLabel is BL_Priority_6, it becomes:
"labels": [ BL_Priority_6 ]
That’s invalid JSON (no quotes around the string).
How to try fix it
You need to force Make to wrap that variable in quotes inside the JSON array:
"labels": [ "{{priorityLabel}}" ]
This way, when Make substitutes, it becomes:
"labels": [ "BL_Priority_6" ]
Valid JSON
Matches Jira API’s expected format.
Full example for Jira ticket creation body
{
"fields": {
"project": { "key": "YOURPROJECTKEY" },
"summary": "Test ticket",
"issuetype": { "id": "3" },
"labels": [ "{{priorityLabel}}" ]
}
}
If you still get errors, double-check:
-
priorityLabel has no extra quotes in its value already (otherwise you’d end up with "\"BL_Priority_6\"" in JSON).
-
Jira project permissions allow adding labels.
-
The label matches Jira’s naming rules (no spaces, only letters/numbers/underscores).
i hope this helps you, best regards.
2 Likes