web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to convert XML to ...
Power Automate
Answered

How to convert XML to JSON

(0) ShareShare
ReportReport
Posted on by 25

Hi,

I am a new user. Can anyone help me how to convert XML data to JSON? or how to refer to parameters in XML?

<Positions>
	<Positions id="1699271935983345" idBox="9118" positionLatitude="51.80883" positionLongitude="108.84533" address="SE, address" asimuth="186" velocity="0" fuelLevel="12" engineOn="0" distanceTotal="54555" fuelConsumptionTotal="" idTrailer="" idDriver="" timeStamp="2023-10-06 11:59:53"/>
	<Positions id="1699271935808563" idBox="9631" positionLatitude="52.82442" positionLongitude="109.01721" address="PL, address" asimuth="96" velocity="69" fuelLevel="45" engineOn="0" distanceTotal="445666" fuelConsumptionTotal="" idTrailer="" idDriver="" timeStamp="2023-10-06 11:57:54"/>
	<Positions id="1699271935740443" idBox="9733" positionLatitude="53.89404" positionLongitude="93.07141" address="BE, address" asimuth="252" velocity="44" fuelLevel="35" engineOn="1" distanceTotal="706237" fuelConsumptionTotal="285498" idTrailer="" idDriver="" timeStamp="2023-10-06 11:56:52"/>
</Positions>

 

Categories:
I have the same question (0)
  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @Lukinfo 

    If you want to convert the xml to json in Power Automate you just need to use this:

     

    json(xml('<Positions>
    	<Positions id="1699271935983345" idBox="9118" positionLatitude="51.80883" positionLongitude="108.84533" address="SE, address" asimuth="186" velocity="0" fuelLevel="12" engineOn="0" distanceTotal="54555" fuelConsumptionTotal="" idTrailer="" idDriver="" timeStamp="2023-10-06 11:59:53"/>
    	<Positions id="1699271935808563" idBox="9631" positionLatitude="52.82442" positionLongitude="109.01721" address="PL, address" asimuth="96" velocity="69" fuelLevel="45" engineOn="0" distanceTotal="445666" fuelConsumptionTotal="" idTrailer="" idDriver="" timeStamp="2023-10-06 11:57:54"/>
    	<Positions id="1699271935740443" idBox="9733" positionLatitude="53.89404" positionLongitude="93.07141" address="BE, address" asimuth="252" velocity="44" fuelLevel="35" engineOn="1" distanceTotal="706237" fuelConsumptionTotal="285498" idTrailer="" idDriver="" timeStamp="2023-10-06 11:56:52"/>
    </Positions>'))

     

     

    Then the result is as follows:

    vyueyunmsft_0-1699432845575.png

     

    For this , you can also refer to :
    Reference guide for expression functions - Azure Logic Apps | Microsoft Learn

     

    If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.


    Best Regards,

    Yueyun Zhang

  • Lukinfo Profile Picture
    25 on at

    Thank you very much for your answer. I noticed that the input data did not look like I wrote, hence my problems, but thank you anyway. Can you help me how to refer to individual elements in a loop?

  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @Lukinfo 

    Thanks for your quick response , sorry for i am not surely understand " the input data did not look like I wrote" ,in the above reply i just copy your xml in my function,and do you mean you want to get the  individual elements in a loop?

    You can try to use the "Apply to each" action in flow:
    For example , this is the json:

    vyueyunmsft_0-1699434495095.png

    We can use this flow:

    vyueyunmsft_1-1699434596333.png

    Then we can get the "@id" in a loop.

     

     

    If I misunderstand what you mean, you can describe your needs and your expected outcomes in detail so that we can better help you.


    Best Regards,

    Yueyun Zhang

     

  • Lukinfo Profile Picture
    25 on at

    Thank you very much. This is exactly what I need.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard