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 Platform Community / Forums / Power Automate / Pulling information fr...
Power Automate
Unanswered

Pulling information from JSON/XML array

(0) ShareShare
ReportReport
Posted on by 21

Hi folks

 

I feel like this solution is staring me in the face but I can't quite seem to get there. 

 

I'm pulling information, in xml or json, from an api. This is returning several paramaters, including an array as per below (in json format). Each of the below is for one specific job. 

 

I am trying to pull the value for where the label equals x. 

 

Name = Jim McJohn

Contact Details = 123456

Sales Exec = John McJim

 

 

[
{
"id": 32165,
"label": "Name",
"third_party_id": "",
"value": "Jim McJohn",
"type": "read_only"
},
{
"id": 987654,
"label": "Contact Details",
"third_party_id": "",
"value": "123456",
"type": "read_only"
},
{
"id": 321456,
"label": "Sales Exec",
"third_party_id": "",
"value": "John McJim",
"type": "not_shown"
},
]

 

 

I feel this should be really simple but it's just catching me out at the moment. Any help anyone could offer would be very much appreciated! 

 

Thank you in advance. 

Categories:
I have the same question (0)
  • Paulie78 Profile Picture
    8,422 Moderator on at
    Re: Pulling information from JSON/XML array

    Would this work? Or do you actually need to filter based on the value of the label (which is possible, just slightly more complex).

     

    2022-08-22_16-24-18.png

    The second compose generates a JSON object. Example output:

    {
     "Name": "Jim McJohn",
     "Contact Details": "123456",
     "Sales Exec": "John McJim"
    }

    The code within each line of the compose is:

    outputs('compose')[0]['value']
    outputs('compose')[1]['value']
    outputs('compose')[2]['value']

    As you can see, it is not collecting the data by the named label, just compiling all three entries into a single object.

     

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

  • Verified answer
    MacAodh Profile Picture
    21 on at
    Re: Pulling information from JSON/XML array

    Firstly thank you very much for replying - I would have responded sooner but I hadn't realised you replied (assumed incorrectly I would get an email...) 

    That would work but what I neglected to mention was I have quite a few fields (28 to be precise), and I want this to be able to take new fields when/if I ever add them.

     

    So what I did, and it took a little pain, was to create a html table from the array and follow the amazing video which I suspect is from yourself:

    How to use Power Automate to parse a HTML Table and convert to JSON 

     

    I then used a join to convert the array to a string, replaced } and { using replace and finally added a curly bracket either side using concat. Suspect this is similar to going from Dublin to London via New York but if it works...

     

    replace(body('Join'),'{','') 
    
    replace(outputs('Replace_{'),'}','') 
    
    concat('{',outputs('Replace_}'),'}') 

     

     

    MacAodh_1-1661433228215.png

     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard