1

I have an array output from ACTIVITY script like this

Input json array
  {
  "result":[
  {
  "Val":[
  {"pqr":1,"srt":2},
  {"pqr":1,"srt":2}
  ]
  }
  ]
  }

How can I iterate this nested json object using a Foreach loop. I am getting error while I use @activity(script).output .result. Val to get the array values. Error: The length cannot be evaluated because property value doesn't exist

2
  • @ RakeshGovindula-MT Commented Jul 16, 2022 at 8:03
  • @wBob yr right ,sure this is corrcet json{ "result":[ { "Val":[ {"pqr":1,"srt":2}, {"pqr":1,"srt":2} ] } ] } Commented Jul 16, 2022 at 10:20

1 Answer 1

2

Set your For Each activity Items to:

@activity('Script').output.result[0].Val

and use it within the activity using the @item() syntax, e.g.

@string(item().pqr)
Sign up to request clarification or add additional context in comments.

6 Comments

@string(item().Val[0]. pqr)->Here the o/p is not looping ,it is only taking first array value I want to get both the values of pqr inside for loop
Thank a lot ,i got stuck on this for a while
Please upvote and make as answer (green tick) of this has been helpful!
Sure wBob I have one query also,I am getting my xml response from restpi,But the columns names i getting from xml response through lookup activity arein fformat @pqr,@xyz like this.So I am unable to read the values inside foreach .(@string(item().@BookedLossu) ->showing error so how to read the column nvalues from xml
That’s a separate question really. Why not upvote and mark this one as answered, and open a new one with your sample data and expected results? I am sure someone will be able to help you.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.