Skip to main content

Notifications

Community site session details

Community site session details

Session Id : IwiHxfgfUYSGz9EjZoc3kg
Power Automate - Power Automate Desktop
Unanswered

Get list of properties from custom object

Like (0) ShareShare
ReportReport
Posted on 8 Dec 2021 19:16:50 by 2

I am building a flow that has a custom object with, let's say, the following data in json:

 

{
"foo": "a",
"bar": "b",
"baz": 100
}

 

This json comes from a Web API and may change depending on what is being sent. I wanted to know if there is a way to extract the list of properties to loop over. I.E, in this case I would have a list of Text ["foo", "bar", "baz"]

 

 

  • anp882 Profile Picture
    10 on 13 May 2024 at 20:37:10
    Re: Get list of properties from custom object

    I tried the following in a condition and an object assigned to a variable
    This:
    variables('YourVariable')?['YourProperty'] is equal to null
    was not evaluating to true, even when property didn't exist. But this:
    empty(variables('YourVariable')?['YourProperty']) is equal to true
    was working fine.

  • tfitzger Profile Picture
    2 on 09 Dec 2021 at 18:50:28
    Re: Get list of properties from custom object

    Thanks, @Henrik_M . I have something like that already in place, but I was curious if there was something less hacky. Ah well.

  • Henrik_M Profile Picture
    2,006 Super User 2024 Season 1 on 08 Dec 2021 at 22:28:51
    Re: Get list of properties from custom object

    I'm not sure if there is a way to extract the property names from the object, put I guess you could use a regex "hack" to grab them from the JSON string. Try pasting this into your desktop flow:

    SET JSON TO $'''{
    \"foo\": \"a\",
    \"bar\": \"b\",
    \"baz\": 100
    }'''
    Text.ParseText.RegexParse Text: JSON TextToFind: $'''(?<=\").+?(?=\":)''' StartingPosition: 0 IgnoreCase: False Matches=> Matches

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard
Loading started