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 / array of keys() and ar...
Power Automate
Unanswered

array of keys() and array values() expression for object

(0) ShareShare
ReportReport
Posted on by 4

Why the hell doesn't this exist already? I'm trying to write a boilerplate Power Automate flow that I can use for all Microsoft forms - not just one. I don't want to parse a JSON object and manually place dynamic content. I want to get an array of keys with the expression keys(body('Parse JSON')) -> ["a", "o", "g"]

 

 

dict.png

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

    Hi , @rockyfjord 

    Now in Power Automate , it do not have the function to extract the keys and values for a json object .

    But we can use the xml() and xpath() function to help to extract the keys and values.

    And for the steps you can refer to :
    ForEach Property in #MicrosoftFlow JSON. With XPath? #microblog — John Liu .NET

     

    And you can also refer to the similar case as here :
    Solved: Getting JSON keys in flow - Power Platform Community (microsoft.com)

    Modify the Array Values During Runtime - Power Platform Community (microsoft.com)

     

     

    If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.


    Best Regards,

    Yueyun Zhang

     

     

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

    You can do this with xPath.

     

    But you have to take care of XML's character encoding

    (see https://powerusers.microsoft.com/t5/Building-Flows/extracting-data-from-json-with-changing-key-based-on-date/m-p/2467376/highlight/true#M275757)

     

    Chriddle_0-1700648248266.png

    From:

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

    Map:

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

     

    Chriddle_1-1700648494921.png

     

  • rockyfjord Profile Picture
    4 on at

    Thanks all. This is the working solution I came across, but I was hoping for something a bit more intuitive. A Python Azure function that performs all of the necessary SharePoint replacements is probably what I'll end up rolling with.

    SharePoint Column Display Names 

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard