How can I avoid unintended conversions when using the REST API to register a description of an ISSUE

Tashiro_ Hideyuki August 15, 2022
When using the JIRA REST API to register a description of an issue, \(two backslashes) may or may not be converted to a newline. (See pattern below).
Can you please tell me what kind of pattern is used to convert them to newlines and how to prevent them from being converted to newlines?
 
・If ”\\/” is set, the description is registered in the state of ”\\/”.
・If ”\\n” is set, the description is registered in the state of ”\\n”.
・If ”\\r” is set, the description is registered in the state of ”\\r”.
・If ”\\uXXXX” is set, the description is registered in the state of ”\\uXXXX”.
・If ”\b” is set, Description is registered in the state of line feed and b.
・If ”\t” is set, Description is registered in the state of line feed and t.
・If ”\f” is set, Description is registered in the state of line feed and f.

1 answer

1 accepted

0 votes
Answer accepted
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2022

Hi @Tashiro_ Hideyuki

welcome to the Atlassian Community.

Can you let us know which programming language/tool you are using to perform the REST requests? As long as your programming language properly escapes the content, you shouldn't need to worry about this.

Cheers,
Matthias.

Tashiro_ Hideyuki August 15, 2022

Thank you very much for your reply.
The programming language is python.

Like Monica_Casais likes this
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2022

Oh, while searching for some information, I've stumbled across this article which mentions some reserved characters which actually might be your problem:

The following characters are reserved characters and can not be used in JSON and must be properly escaped to be used in strings.

  • Backspace to be replaced with \b

  • Form feed to be replaced with \f

  • Newline to be replaced with \n

  • Carriage return to be replaced with \r

  • Tab to be replaced with \t

  • Double quote to be replaced with \"

  • Backslash to be replaced with \\

Tashiro_ Hideyuki August 15, 2022

Thank you very much. I understood very well.

Like Matthias Gaiser _K15t_ likes this
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 15, 2022

Fyi: If this answer solved your problem, it's best to accept the answer so that other users can find it easily in the future.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events