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

Community site session details

Session Id :
Power Automate - Building Flows
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..

 

I have the same question (0)
  • grantjenkins Profile Picture
    11,059 Moderator on at
    Re: Get JSON Properties List

    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
    Re: Get JSON Properties List

    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,059 Moderator on at
    Re: Get JSON Properties List

    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
    Re: Get JSON Properties List

    Hi @grantjenkins 

    Let me try it and give you reply asap.

  • SalmanShaik Profile Picture
    30 on at
    Re: Get JSON Properties List

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard