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 / picking a variable fro...
Power Automate
Unanswered

picking a variable from a array nested in a json

(0) ShareShare
ReportReport
Posted on by 39

Hi All,

 

I have a json response, which returns an array, with company data called farms, and within that array is a second nested array, named relations . I need a value from each of those (farmID from the main array "farms" and partyID from the nested array "relations".)

I have been able to fill a variable with FarmID and do that for all companies in the json, with a for each loop. However if I want to add the second variable, power automate starts to create nested loops, which seem to go nowhere and get stuck (infinite loop perhaps?)


What i need to happen is that i loop through each company, set the farm and party ID, so I can use it in another HTTP get, after which we go to the next company..rince repeat..

 

Does anyone have any idea, I was maybe thinking I need to call a specific array value in a parent/child manner like  farm?relations?[0], but havent been able to get that syntax to work

 

Below what is happening: I created the two set variables actions, but MS moves the second one (which is the nested array) automatically in to the last for each loop (for each 1)

hanssmeets_0-1707705007585.png

Example json from postman:

hanssmeets_1-1707705457318.png

PS the output from the parse json has the information exactly the same as the postman output.

Does anyone have any ideas, or a better way to do it, in case I am completely off track
Cheers

Hans



 

 

Categories:
I have the same question (0)
  • Verified answer
    narayan225 Profile Picture
    2,547 Super User 2025 Season 2 on at

    @hans-smeets 

     

    I used the same data you provided and it is working fine in my case.

    narayan225_0-1707711353607.pngnarayan225_1-1707711378315.png

    Please try this and check. It should work fine for you too.

     

    Cheers!

  • Hans Smeets Profile Picture
    39 on at

    EDIT: I managed to get it to work, the problem wasn't in the code, but the fact I was using the "New editor" caused the problem. When switching back to the "old" one, no more nested loops. 

    hanssmeets_2-1707770660115.png

     

    That one insist on creating nested loops

    Hi @narayan225  , thanks for this, sadly it doesn't work for me, the moment I add the "& Parent: {x}PartyID, power automate  automatically creates the nested flows (it chooses For Each loops), turning it into a, what appears to be an infinite loop when you test it...I am completely stumped.

    The only thing that is different is that the sample I gave has only 1 farm and ID in it, and in reality there are about 30 companies in the array "Farms"

    Screenie of my flow when I try to replicate yours. I have also attached a word doc to the post to give a broader example with 3 farms.

     

    EDIT: I tried to not create the second apply to each, knowing it would nest loops anyway,  but that didn't help either.

    hanssmeets_1-1707767272409.png

    Below a screenieof the 1st two farms in the json (word doc attached)

    hanssmeets_0-1707766851147.png



     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard