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 / 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,136 Super User 2026 Season 1 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

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard