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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to iterate through...
Power Automate
Unanswered

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!

 

 

 

 

Categories:
I have the same question (0)
  • v-liwei-msft Profile Picture
    on at

    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,063 Moderator on at

    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

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard