Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

XML to JSON convert trouble

(0) ShareShare
ReportReport
Posted on by

Hi everybody,

 

I want to get exchange rates from Sweden Central Bank with API and insert them about D365 entity. 

I connect the API as below.

I got the connection results from API as xml.

Xml results are as follows:

image.png

 

Then, I tried to convert results to JSON from XML using Compose action within json() expression.

 

json(xml(body('HTTP')))

 

image.png

I tried to extract results with Parse JSON action as follow: 

 

image.png

I try to get the result as below but because of @xmlns it gives "#text": "<data>" the data I need.

 

{
 "?xml": {
 "@version": "1.0",
 "@encoding": "UTF-8"
 },
 "SOAP-ENV:Envelope": {
 "@xmlns:SOAP-ENV": "http://www.w3.org/2003/05/soap-envelope",
 "SOAP-ENV:Body": {
 "ns0:getMonthlyAverageExchangeRatesResponse": {
 "@xmlns:ns0": "http://swea.riksbank.se/xsd",
 "return": {
 "@xmlns": "",
 "datefrom": {
 "@xmlns": "",
 "#text": "2020-11-02"
 },
 "dateto": {
 "@xmlns": "",
 "#text": "2020-11-30"
 },
 "informationtext": {
 "@xmlns": "",
 "#text": "Averages are calculated on published observations for the daily fixing rates. \r\n\r\nObservations are published daily at 12.15 p.m."
 },
 "groups": {
 "@xmlns": "",
 "groupid": {
 "@xmlns": "",
 "#text": "130"
 },
 "groupname": {
 "@xmlns": "",
 "#text": "Currencies against Swedish kronor"
 },
 "series": [
 {
 "@xmlns": "",
 "seriesid": {
 "@xmlns": "",
 "#text": "SEKAUDPMI"
 },
 "seriesname": {
 "@xmlns": "",
 "#text": "AUD"
 },
 "unit": {
 "@xmlns": "",
 "#text": "1.0E0"
 },
 "resultrows": {
 "@xmlns": "",
 "period": {
 "@xmlns": "",
 "#text": "2020 November"
 },
 "min": {
 "@xmlns": "",
 "#text": "6.2465E0"
 },
 "average": {
 "@xmlns": "",
 "#text": "6.2861E0"
 },
 "max": {
 "@xmlns": "",
 "#text": "6.3272E0"
 },
 "ultimo": {
 "@xmlns": "",
 "#text": "6.2627E0"
 }
 }
 },

 

What I want here is that there should not be @xmlns and "#text" objects in the result.

I want the results to be directly against the relevant objects: 

 

"seriesid":"SEKAUDPMI",
"seriesname":"AUD",
"unit": "1.0E0",

 

What method can I use to get the format I need? 

 

  • Community Power Platform Member Profile Picture
    on at
    Re: XML to JSON convert trouble

    Hi @v-litu-msft,

     

    I tried your solution as below:

    Omer_Orhan_0-1608722005298.png

     

    I run it but I didn't get solution I wanted.

    I still got the object I didn't want following,

    image.png

    Should I apply the solution in a different section or should your solution be implemented when converting HTTP result to JSON? 

    Omer_Orhan_0-1608724638154.png

     

     

  • v-litu-msft Profile Picture
    on at
    Re: XML to JSON convert trouble

    Hi @Anonymous,

     

    You could initialize an array variable to store the array of series, then append the restructured data into the array:

    Screenshot 2020-12-23 103736.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1