Getting error There was an error parsing JSON. Check that your request body is valid.

Atul Aggarwal
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!
September 21, 2021

Getting below error when creating an issue with special characters in description like '£' and '@'.

{\"errorMessages\":[\"There was an error parsing JSON. Check that your request body is valid.\"]}

So can anyone help on how can we create issues with special characters in the description using api?

4 answers

0 votes
Felipe N Ribeiro
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!
November 29, 2024

If you are getting the problem when using Jira Automation and doing a POST webhook, the error is probably in the command:

"summary": "{{issue.summary}}"

replace with:

"summary": "{{issue.summary.jsonEncode}}"


https://confluence.atlassian.com/automation/jira-smart-values-text-fields-993924863.html#:~:text=on%C2%A0StringUtils.isNumeric()-,jsonEncode,-() 

0 votes
Shruti Misra
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!
February 9, 2022

Still getting same error without any special character as well.

0 votes
Adam Sterrie
Contributor
September 21, 2021

We found out the hard way that Atlassian REST APIs are super-sensitive to non-alpha-numeric characters. The REST APIs are just not robust enough to trust so you may find a way to create an issue with a special character in it but you will likely have problems elsewhere down the line.

So my advice is: Avoid special characters like the plague.

Instead, keep the summary (I presume) "detail light" and put all the messy stuff in the description.

Atlassian may be about to release a whole new set of super amazing reliable robust function-rich REST APIs (because the current set for use with the cloud are not up to the job of competing with Server or Data Center), but I wouldn't hold my breath!

Rafael Pinto Sperafico
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2021

Hi @Atul Aggarwal ,

No problems while creating Jira issues containing '£' or '@' when using REST API (https://docs.atlassian.com/software/jira/docs/api/REST/8.13.0/):

Request

curl -u admin:admin \
-H 'Content-type: application/json' \
-d '{"fields": {"project": {"id": "10100"},"summary": "Pound sign £", "description": "Pound sign £", "issuetype": {"id": "10000"}}}' \
http://localhost:8080/jira/rest/api/2/issue
{"id":"10201","key":"FOO-1","self":"http://localhost:8080/jira/rest/api/2/issue/10201"}

Request

curl -u admin:admin \
-H 'Content-type: application/json' \
-d '{"fields": {"project": {"id": "10100"},"summary": "At sign @", "description": "At sign @", "issuetype": {"id": "10000"}}}' \
http://localhost:8080/jira/rest/api/2/issue
{"id":"10202","key":"FOO-2","self":"http://localhost:8080/jira/rest/api/2/issue/10202"}

Jira Base URL in example above http://localhost:8080/jira

0 votes
Tadas Apulskis September 21, 2021

Try using utf-8 what language is the script?

Suggest an answer

Log in or Sign up to answer