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 / Get JSON Properties List
Power Automate
Answered

Get JSON Properties List

(0) ShareShare
ReportReport
Posted on by 30

Hi Community,

I have an array which contains only one row and different properties these properties are dynamic they will get change. I want to get only the property names of an array in a separate array.

{

status:200

headers:{}

body:{

.{}

.{}

.{}

labels:{

A{}

B{}

C{}

}

}

}

 

In this case i need output as [A,B,C] keep in mind A,B,C are not fixed they may increase/decrease dynamically.

Please help me here..

 

Categories:
  • grantjenkins Profile Picture
    11,063 Moderator on at

    Are you able to provide some sample JSON as the JSON you provided isn't valid. You also mentioned the JSON had an array, but no array that I can see.

  • SalmanShaik Profile Picture
    30 on at

    Hi @grantjenkins 

    The Json contains nearly 2000 lines so i am just pasting the structure here.
    {

    "Status Code":200,

    "headers": {

    .

    .

    .

    },

    "body":

    {

    "data context":"xyz",

    "response": {

    "data type":"xyz",

    "output": {

    "Count":1,

    "Layout":""

    "tables":{

    "type":""

    },

    "labels": {

    "name":""

    "A":

    {

    // Huge data is there inside

    }

    "B":

    {

    // Huge data is there inside

    }

    "C":

    {

    // Huge data is there inside

    }

    }

    }

    }

    }

    }

     

    If there any syntax mistakes please adjust this is the overall structure, i need the output as [A,B,C]
    Let me know if you have any query

     

  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    I've based the JSON data on the following. Note that this has a "name" field within "labels" as well as "A", "B" and "C".

     

    {
     "Status Code": 200,
     "headers": {},
     "body": {
     "data context": "xyz",
     "response": {
     "data type": "xyz",
     "output": {
     "Count": 1,
     "Layout": "",
     "tables": {
     "type": ""
     },
     "labels": {
     "name": "",
     "A": {},
     "B": {},
     "C": {}
     }
     }
     }
     }
    }

     

    Below is the full flow. I'll go into each of the actions.

    grantjenkins_0-1700660300444.png

     

    JSON is a Compose that contains the JSON data you provided (as shown above).

    grantjenkins_1-1700660335639.png

     

    Select uses the following expressions to extract out the names. Note that this converts your JSON to XML then uses XPath to extract the data.

    //From (Option 1)
    //If you wanted to get all names from within "labels" including "name".
    xpath(xml(json(concat('{"root": { value:', outputs('JSON'), '}}'))), '//response/output/labels/*')
    
    //From (Option 2)
    //If you wanted to get all names from within "labels" excluding "name".
    xpath(xml(json(concat('{"root": { value:', outputs('JSON'), '}}'))), '//response/output/labels/*[name(.) != "name"]')
    
    //Map
    xpath(item(), 'name(/*)')

    grantjenkins_2-1700660549388.png

     

    After running the flow (with the second From expression to exclude "name") we would get the following.

    grantjenkins_3-1700660673812.png

  • SalmanShaik Profile Picture
    30 on at

    Hi @grantjenkins 

    Let me try it and give you reply asap.

  • SalmanShaik Profile Picture
    30 on at

    Hi @grantjenkins 

    It worked for me. Thanks for your Solution....

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 302 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 130

Last 30 days Overall leaderboard