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,300,859
Community Members
 
Community Events
165
Community Groups

How to convert webresponse to text

I am using Automation for Jira to request information using a web request. It returns a JSON that is in fact not really useful:

{latest=2022-05-03T15:16:30+00:00, employees={598={id=598, action=Inserted, lastChanged=2022-05-02T18:19:51+00:00}, 602={id=602, action=Inserted, lastChanged=2022-05-02T18:19:51+00:00}, 603={id=603, action=Inserted, lastChanged=2022-05-03T15:16:30+00:00}}}


In fact I need 3 ids from this JSON. But objects in employees are not a part of array, it is a hash map. When I use webresponse.body.employees I have no idea how to extract ids.

A good solution would be to convert employees to string, use split function and convert it to array. E.g.

{{webResponse.body.employees.asText.split("={id=")}}

however this does not work and returns empty text.

Are there any ideas? 

 

1 answer

This works

{{webResponse.body.employees."603"}}

It returns 

{id=603, action=Inserted, lastChanged=2022-05-03T15:16:30+00:00}

However I do not know "603" for every response, today it is 603, tomorrow it will be 620. 

It would be nice to have something like a list of keys of a json object

{{webResponse.body.employees.keys}}

that I can iterate through.

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