Skip to main content

Notifications

Community site session details

Community site session details

Session Id : IwAb7b3UB2atEGpxDw7HW7
Power Automate - Building Flows
Unanswered

How to get the elements from a JSON object

Like (0) ShareShare
ReportReport
Posted on 23 Sep 2022 15:25:26 by 143

Hi All, 

 

I am trying to get a string value from within a JSON object that I receive. I would like to have have a string after the ParseJSON step which shows the product names - "Product Name A;Product Name B;Product Name C;Product Name D"

 

 

[
 {
 "CustomerName": "Customer A",
 "DocumentType": "Word",
 "Product": [
 {
 "Value": "Product Name A"
 },
 {
 "Value": "Product Name B"
 },
 {
 "Value": "Product Name C"
 },
 {
 "Value": "Product Name D"
 }
 ]
 }
]

 

 

  • Ellis Karim Profile Picture
    10,927 Super User 2025 Season 1 on 24 Sep 2022 at 17:18:36
    Re: How to get the elements from a JSON object

    The demo flow I posted does not need the Parse JSON action. It uses an expression to "grab" the Product array.

     

    Place your data in to the varJSON variable: 

     

    Snag_9bd5f96.png

     

    However, if you still need to use the Parse JSON function, then modify the expression in the Select action to: 
    body('Parse_JSON')?[0]?['Product']

     

    Snag_9bf66a1.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Dhiran Profile Picture
    143 on 24 Sep 2022 at 15:16:18
    Re: How to get the elements from a JSON object

    Hi @ekarim2020 

     

    Thank you for your answer and I tried your steps but had no success 😞

     

    I also look at the raw output of my ParseJSON step and it also had the word body at the head of of the object. I assumed I could just reference the using this expression "outputs('ParseJSON')?['body']?['Product'] but that also failed.

     

     

     

    {
     "body": [
     {
     "CustomerName": "Customer Name",
     "DocumentType": "Word"
     "Product": [
     {
     "Value": "Product A"
     },
     {
     "Value": "Product B"
     },
     {
     "Value": "Product C"
     },
     {
     "Value": "Product D"
     }
     ]
     }
     ]
    }

     

     

  • Ellis Karim Profile Picture
    10,927 Super User 2025 Season 1 on 23 Sep 2022 at 19:23:21
    Re: How to get the elements from a JSON object

    Hi @Dhiran ,

     

    We can use the Select and Join actions to create the string.

    Snag_505645d.png

    (2) We can use the Select action Product property. We use the Select action to select the first item (0) of the varJSON array variable, and then specify the Product property - which is also an array. The expressions are shown below:

    Snag_5047190.png

    The output of the Select action is an array of product names:

     

    [
     "Product Name A",
     "Product Name B",
     "Product Name C",
     "Product Name D"
    ]

     

     

    (3) Finally, we can join all the product names together using the Join action

    Snag_504a775.png

    The output of the Join action is:

     

    Product Name A;Product Name B;Product Name C;Product Name D

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

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…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,075 Most Valuable Professional

Leaderboard