Forums

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

How Can I access list of items in JSON using Jira Automation ?

Yogesh Ranjitkar April 4, 2023

Hi All,

 

I am new to Jira Automation and I am trying to capture the result of webrequest using Jira automation. But when I try to get the items of the list contained in JSON, I get no response. Could you please help me with it?

The payload is similar to:

{
"maxResults": 100,
"startAt": 0,
"total": 3,
"isLast": false,
"values": [
{
"id": "130",
"value": "ABC",
"disabled": false
},
{
"id": "140",
"value": "XYZ",
"disabled": false
},
{
"id": "130",
"value": "AABB",
"disabled": false
}]

 

and the print smart value that I am using it {{webResponse.body.values(0)}} to access the first element so that my expected outcome is {"id": "130","value": "ABC","disabled": false}

2 answers

1 vote
Danish Magrey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2023

It should be something like: 

webResponse.body.values.get(2)

Something similar is stated here :

https://community.atlassian.com/t5/Automation-questions/Accessing-a-JsonArray-syntax/qaq-p/1938007#:~:text=webResponse.body.results.version.number.get(2)

Also as @Bill Sheboy stated, it would be better if we know the complete web request return to understand the exact smart value to be entered. 

Basile CAVRIL
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!
July 23, 2024

That's the correct answer 

Thank you

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2023

Hi @Yogesh Ranjitkar 

You note that the "payload is similar to..." but does it exactly match what you are expecting?

One way to check this is to write the entire response to the audit log after the webrequest to learn what is happening.

And...have you selected the option to wait for the webrequest return before continuing with the rule steps?

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events