web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to iterate through JSON Outputs?

(0) ShareShare
ReportReport
Posted on by 503

Hi there, 

 

I have some JSON from a compose output seen as below: 

 

[
 {
 "uim_name": "Timothy Barnes",
 "uim_answer": true
 }, 
 {
 "uim_name": "Ashley Barnes",
 "uim_answer": false
 },
 {
 "uim_name": "John Shelborne",
 "uim_answer": false
 }
]

 

 I am trying to 'update a row' in Dataverse if all of the "uim_answer" values equal 'true'. Can someone help me write out the formula needed for this? I'm assuming it would need to be written inside a compose. 

 

Apply to Each and a condition does not work as it takes each value separately and updates the rows separately inside each loop. 

 

Thanks in advance for your help!

 

 

 

 

I have the same question (0)
  • v-liwei-msft Profile Picture
    on at
    Re: How to iterate through JSON Outputs?

    Hi @Usernametwice23 

     

    You can attach the uim_answer in the Json to an array variable through Apply to each.
    Use a conditional to do nothing if the array variable contains false.
    update row if not contain false

    I have made a test for your reference:

    vliweimsft_0-1670484230595.png

    vliweimsft_1-1670484241288.png

     

    Best Regards,

    Levi

  • Verified answer
    grantjenkins Profile Picture
    11,059 Moderator on at
    Re: How to iterate through JSON Outputs?

    We can use a single expression within a Condition to check across all objects and see if all of them are true (there are no objects set to false).

     

    The expression below converts your array of objects into XML, then uses XPath to return all items where uim_answer is equal to false, which is then wrapped inside a length expression. In our Condition we can check to see if that length is equal to 0, and if it is then it means all uim_answer values must be true. In that case, we go into the Yes branch and update our row in Dataverse.

     

    length(xpath(xml(json(concat('{"root": { values:', outputs('Compose'), '}}'))), '//root/values[normalize-space(uim_answer)="false"]'))

     

    grantjenkins_0-1670504155065.png

     

  • Usernametwice Profile Picture
    503 on at
    Re: How to iterate through JSON Outputs?

    Perfect just what I was needing! Thank you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard