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 select a Dynami...
Power Automate
Unanswered

How to select a Dynamic Json Property name

(0) ShareShare
ReportReport
Posted on by 5

Hello all,

 

I have a json output that looks similar to the below:

[
{
"39c04006-00d0-11e8-9bea-0275d4b83f51": {

"user_name": "test2"
},
"3a24d728-00d0-11e8-8494-0275d4b83f51": {

"user_name": "test3"

}
}
]

the name of the property aka the GUID above can be dynamic and this object array can have 3 or more objects. How can I turn this into a proper array so I can select all "user_name" from the json object.

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,394 Most Valuable Professional on at

    @juanpowerapps91 ,

    You could retrieve the values using indexes instead of field names.

     

    outputs('Compose')[0]['user_name']

    outputs('Compose')[1]['user_name']

    outputs('Compose')[2]['user_name']

  • juanpowerapps91 Profile Picture
    5 on at

    Thank you for the answer. Unfortunately that's not going to work as the object is not an array. All the answers seem to indicate that this is not possible using out of the box functions in power automate. To loop through json objects you will need to use a c# or java script to accomplish this

  • powerappsusercr Profile Picture
    2 on at

    Hey Juan, im in the same situation. How did you accomplish that?

     

    Thanks

  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Chriddle_0-1711355196242.png

    From:

    xpath(
     xml(
     json(
     concat(
     '{"Root":{"Item":',
     outputs('Compose'),
     '}}'
     )
     )
     ),
     '/Root/Item/*'
    )

    Map Id:

    replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(		
    	xpath(
    		item(),
    		'name(/*)'
    	),
    	'_x0030_','0'),'_x0031_','1'),'_x0032_','2'),'_x0033_','3'),'_x0034_','4'),'_x0035_','5'),'_x0036_','6'),'_x0037_','7'),'_x0038_','8'),'_x0039_','9'
    )

    Map UserName:

    xpath(
    	item(),
    	'string(/*/*)'
    )

     

    Result:

    [
     {
     "Id": "39c04006-00d0-11e8-9bea-0275d4b83f51",
     "UserName": "test2"
     },
     {
     "Id": "3a24d728-00d0-11e8-8494-0275d4b83f51",
     "UserName": "test3"
     }
    ]

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