Forums

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

Format incoming API data

Gene Rinaman September 20, 2018

I am pulling in API data from a mongo db via:

new URL("http://apiaddress.internal.com:2017/companies").text

This is bringing in the data in the following format:

{"companies":[{"name":"CompanyA","domains":["companya.com"]},{"name":"CompanyB","domains":["companyb-test.com","companyb.com","cb.com"]},

I would like to populate a select list with just the company names.  

I'm using Scriptrunner and JIRA 7.5.4 on-premise

 

1 answer

0 votes
Nir Haimov
Community Champion
September 20, 2018

Usually, the format you mentioned is JSON in string format, and you need to parse that string to real JSON.

Then you will be able in ScriptRunner groovy to extract from that JSON the exact data you want.

Suggest an answer

Log in or Sign up to answer