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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / array of keys() and ar...
Power Automate
Answered

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
    Microsoft Employee 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,672 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard