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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.