Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Extract value from an object

Like (1) ShareShare
ReportReport
Posted on 10 Dec 2019 11:09:21 by

Dear all,

 

I am building a flow where I want to extract a specific information from a specific object which is inside an array. So far I have done:

1. Filter the array to only have the object I am interested on. (I used "Filter array" action)

2. Remove all the information of the object except the one I am interested on. (I used "Select" action)

3. I have extracted that object from the array. (I used "First(body('Select'))").

 

Now I have an object as simple as below. BUT I don't know how to extract the value "10" (on this example is 10, but it is a variable and on each run of the flow it will change).

 

 

{
 "ID": "10"
}

 

 

To add more information. I am looking for an specific file on my SharePoint Document Library, using another property of the file to find it (I am using the barcode value, so I'm sure there is only one. This is the information I used on the Filter array action). So, to find and extract this file on flow, I need the ID number. but so far I am locked on the step I mentioned below.

 

I hope someone can support on this.

 

 

Thanks

 

  • whyonearth Profile Picture
    126 on 29 Feb 2024 at 03:30:09
    Re: Extract value from an object

    @FreddieV  this doesnt look like it needs to be converted to json, but I can demo two possible solutions:

     

    if need to convert to json, as @richardxp said:

    json(outputs('Search_for_users_(V2)')[0]?['propertyname'])

     

    if its already a json object (which I think it is) then just use:

    outputs('Search_for_users_(V2)')[0]?['propertyname']

    or

    first(outputs('Search_for_users_(V2)'))?['propertyname']

     

    first(outputs('Search_for_users_(V2)'))?['AccountEnabled'] will output 'true' as a bool value. 

     

    This is easy enough if you're using that expression in one or two fields, but if you want to use any/all of those properties across many locations, feed one of the expressions above into a Parse JSON action and use the user object (from your picture, the data between the {}, including the braces) as the sample output.

     

    These expressions can be written anywhere you have an input. Click an entry box, then instead of "Dynamic" choose "expression" and input there. I suppose this is one example of what the "low-code" moniker means, because it's not so much code as it is specifying what value inside an array (stuff inside [ ] brackets) of objects (stuff inside { } braces) you want to select.

  • ninjaryder1st Profile Picture
    232 on 21 Dec 2023 at 16:24:22
    Re: Extract value from an object

    Thanks Richardxp..   is the Json() function you referred to a selectable step in building the flow, or a f(x) function we need to write "low code" for?    I'm still fairly new to this so I need a more literal step by step instruction of the tool/step used to convert string to object and then how to extract ID property.    Appreciate you!

  • richardxp Profile Picture
    2 on 20 Oct 2023 at 14:19:43
    Re: Extract value from an object

    you can use json() function to convert string to object, then extract ID property like
    json(First(body('Select')))['ID']

  • Community Power Platform Member Profile Picture
    on 27 Mar 2023 at 09:34:54
    Re: Extract value from an object

    @FreddieV  I have the same issue. Did you get your answer to this?

     

  • Community Power Platform Member Profile Picture
    on 27 Mar 2023 at 09:13:27
    Re: Extract value from an object

    @Nin I have the same issue. Any luck?

  • ninjaryder1st Profile Picture
    232 on 21 Oct 2022 at 22:10:53
    Re: Extract value from an object

    How do we separate 3 objects that are not within an array identified with square brackets [    ]  ?  

     

    The outputs?(Create_a_Teams_meeting)?['body]?['value']?['propertyName']?['joinUrl'}?['value]  

     has 3 objects 1)  a joinUrl,  2) a tollnumber, and 3) meetingID.

     

    I want to use each of those objects separately (create dynamic content to use later).

    But parse JSON action doesn't work as they are all within { } curly brackets, and are not arrays identified with [ ] square ones and cannot be parsed (creates an error)

  • BKCLabs Profile Picture
    2 on 25 Feb 2022 at 14:57:47
    Re: Extract value from an object

    My very beginner guess would be to make a new step directly after the search, as an "initialize variable" set to an object type, and put the initial value as the output of the "search users" action. This may then let you do the same steps above as the OP was able to do. Of course this will only work if the results of the Search is 1 object. If it will be multiple users, then you will need to make an array variable, and use other actions to pull out the particular object you want.

  • FreddieV Profile Picture
    157 on 02 Dec 2020 at 19:26:17
    Re: Extract value from an object

    I am trying to do the same thing, but I am using the outputs from the 'Search user v2' O365 card, but I can't translate this into selecting the individual components of the outputs. Screenshot below:

     

    Populated-search.png

     

    Does anyone have any ideas about how the expression would look?

  • Community Power Platform Member Profile Picture
    on 11 Dec 2019 at 06:37:20
    Re: Extract value from an object
    Hi InterestedBloke and v-bacao-msft, The three options worked perfectly. Thank you very much!
  • Verified answer
    v-bacao-msft Profile Picture
    on 11 Dec 2019 at 02:05:51
    Re: Extract value from an object

     

    Hi @Anonymous ,

     

    You could store this object in a Compose or an object variable, and then use an expression to extract the value.

    If you are using compose, then you can use the following expression:

    121.PNG

    If you are using variables, then you can use the following expression:

    122.PNG

     

    Best Regards,

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!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started