In this Power Automate tutorial, we will see how to convert XML to JSON using Power Automate.
For example, we will convert the XML code to JSON using Power Automate, like below. Then we will send the JSON data via email by parsing it.
For this, we will create an Instant cloud flow that will trigger manually, taking the user input as an XML file (containing product details) and converting content from base 64 to string using Power Automate. After that, we will convert XML to JSON using JSON().
Once it is converted, we will parse the JSON, create an HTML table, and email the recipients.

How to convert XML to JSON using Power Automate
Here we will see an example of how to convert XML files to JSON using Power Automate.
Step 1: Log in to Power Automate, then click on +Create -> select Instant cloud flow.

Then provide the flow name and select Manually trigger a flow action. Then click on Create.

Now, you can see the Manually trigger a flow action is added to the flow page. Now expand the action -> click on Add an input ->select File inputs.

Step 2: Now we will convert the base64 to string using Power Automate, so, click on the +New step -> select Compose action. Then provide the below information:
- Inputs: Provide the below expression:
base64ToString(triggerBody()['file']['contentBytes'])

Step 3: Now we will convert XML string to JSON using Power Automate, so click on the +New step -> select Compose action. Then provide the below information:
- Inputs: Provide the below expressions:
json(xml(outputs('Compose_-_base_64_to_string')))

Step 4: Now we will parse the JSON, so click on the +New step and select Parse JSON action. Then provide the below information:
- Content: Select the output of the above compose action from dynamic content.
- Schema. To get the schema, click on the Generate from sample button and provide the output of the above compose action. Then click on Done.

Step 5: After that, we will create html table, so click on the +New step -> select Create HTML table action. Then provide the below information:
- From: Select the product from the dynamic content.

Step 6: At last, we will send an email with the above Html table, so click on the +New step -> select Send an email (V2) action. Then provide the below information:
- To: Provide the email id whom you want to send an email
- Subject: Provide the subject of an email.
- Body: Select the output -Create Html table action from dynamic content.