Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get components using python JIRA library

Sandeep
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!
June 16, 2022

Hi All,

We are using Python JIRA library to retrieve details about JIRA Project. We are looking to get component information and for that we are using the "project_components" function mentioned in this documentation https://jira.readthedocs.io/examples.html#projects

But the output returned by this function is in a list format and we are unable to convert this list out to JSON format. Can anyone let me know how to parse the below output we are getting from the project_componets function call. Or if there is a better way to components let me know please

[
<JIRA Component: name=u'component1', id=u'componentid1'>,
<JIRA Component: name=u'component2', id=u'componentid2'>
]

1 answer

0 votes
Mohamed Benziane
Community Champion
June 21, 2022

Hi,

Welcome to the community

First create a new list with te name of all you components

listeName = [component.name for component in componentList]

then convert the list to json

import json

jsonList = json.dumps(listeName)

 

https://pythonexamples.org/python-list-to-json/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events