Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,039
Community Members
 
Community Events
165
Community Groups

How to get components using python JIRA library

Sandeep I'm New Here Jun 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

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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you