How do you Parse the issue description field from jira api

Ryan Meyer March 25, 2020

Currently i'm trying to do this in python but am open to using something else as long as its not too complex.

The issue description field is sent in Atlassian's Document Format which looks something like this:

{'version': 1, 'type': 'doc', 'content': [{'type': 'paragraph', 'content': [{'type': 'text', 'text': 'and i cant lie'}]}]}

The more paragraphs and formatting that is done for the issues description the more complex the structure will be. Is there an easy way to parse/render this down to something viewable? I do not want to do this manually and cant seem to find anything to help in handling this. Im also assuming that comments might be handled this way as well.

There has to be a plugin to make this json format viewable and also a wysiwyg editor, just cant seem to find anything on it

3 answers

0 votes
Muhammad Taimoor Abbasi August 7, 2023

you can use rest/agile/1.0/board/1/issue?jql=key = <Key> endpoint to get parsed description. Other than that I couldn't find any way to parse the description. 

 

For Python there is this peice of code that can parse the description for the most part:

def get_text(content):
result = ''
for i in content:
if 'content' in i:
if isinstance(i['content'],list):
result += get_text(i['content'])
elif 'text' in i:
result += i['text']
elif 'attrs' in i:
result += i['attrs']['url']
return result

print(get_text(d['content']))


0 votes
Murali Sai May 10, 2023

Hi, did you find any way? please help, I'm trying to do the same!

0 votes
jamie April 26, 2020

If only there was a way

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