Hi Jira Community,
I'm integrating Adobe Workfront with Jira Cloud using the REST API v3 (/rest/api/3/issue) and running into an issue when creating Spaces and Tasks with descriptions (Description field) that contain line breaks/newlines.
What works:
- Single-line descriptions create successfully
What fails:
- Descriptions with hard returns/newlines cause a 400 error: "There was an error parsing JSON"
Current approach: I'm using the Atlassian Document Format (ADF) structure:
json
<span>"description": {</span><span> "type": "doc",</span><span> "version": 1,</span><span> "content": [</span><span> {</span><span> "type": "paragraph",</span><span> "content": [</span><span> {</span><span> "type": "text",</span><span> "text": "{{description}}"</span><span> }</span><span> ]</span><span> }</span><span> ]</span><span>}</span>The problem: When {{description}} contains text with line breaks (e.g., from a multi-paragraph field in Workfront), the JSON fails to parse.
What I've tried:
- Replacing newlines with spaces
- Escaping special characters
- Using
stripHTML() functions
Questions:
- How should multi-line text be formatted in the ADF structure?
- Should I split paragraphs into separate ADF paragraph objects?
- Is there a recommended way to sanitize external text data before passing to the Jira API?
Any guidance would be greatly appreciated!
Thanks!
Nick
PS - I'm not a developer, but have been learning.