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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Transform XML Data int...
Power Automate
Unanswered

Transform XML Data into JSON with Nested Objects

(0) ShareShare
ReportReport
Posted on by
I have an XML input that includes a list of products, some of which are considered “main products” with variants, and others are standalone products.
I need to transform this XML data into a structured JSON format where each main product has an array of its variants, and standalone products are listed separately.
I know how to convert XML into JSON, but I’m unsure how to filter and organize data correctly to get the desired JSON output.
Any suggestions or step-by-step guidance would be greatly appreciated!
 
<?xml version="1.0" encoding="UTF-8"?>
<ProductCatalog>
    <Products>
        <Product>
            <ProductNo>1000516</ProductNo>
            <IsMainProduct>0</IsMainProduct>
            <MainProductNo></MainProductNo>
        </Product>
        <Product>
            <ProductNo>1001001</ProductNo>
            <IsMainProduct>0</IsMainProduct>
            <MainProductNo>H1001001</MainProductNo>
        </Product>
        <Product>
            <ProductNo>1001002</ProductNo>
            <IsMainProduct>0</IsMainProduct>
            <MainProductNo>H1001001</MainProductNo>
        </Product>
        <Product>
            <ProductNo>H1001001</ProductNo>
            <IsMainProduct>1</IsMainProduct>
            <MainProductNo></MainProductNo>
        </Product>
    </Products>
</ProductCatalog>
 
{
  "product_data": [
    {
      "product_number": "H1001001",
      "variants": [
        {
          "product_number": "1001001"
        },
        {
          "product_number": "1001002"
        }
      ]
    },
    {
      "product_number": "1000516"
    }
  ]
}
 
Categories:
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi,
     
    Does the below json is is the variants of products ?
     
    is it not in xml structure ?
     
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard