Skip to main content

Notifications

Power Automate - Building Flows
Answered

EQUIVALENCES OF VARIOUS XML FILES FOR PARSE JSON

(0) ShareShare
ReportReport
Posted on by 290

Hello Community,


I have several XML files, but there are files that have one item and others have 5 or more items.


When using PARSE JSON, it works in some files but in another it gives me an error.


How can I do PARSE JSON equivalence for all my XML files?


I attach two files, the 714 file works fine for me, but the 951 gives me an error.

 

I leave images of the flow

 

fgonzalez515_0-1697936954590.png

 

 

fgonzalez515_1-1697936977365.png

 

 

  • fgonzalez515 Profile Picture
    fgonzalez515 290 on at
    Re: EQUIVALENCES OF VARIOUS XML FILES FOR PARSE JSON

    Hi @grantjenkins 

     

    Thanks for your answer.

    I was able to find a solution.

  • grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: EQUIVALENCES OF VARIOUS XML FILES FOR PARSE JSON

    That definitely makes it interesting. It might be better to work directly with the XML rather than converting it to JSON.

     

    What exactly are you trying to extract out of the XML documents? I can try to provide some XPath expressions that work on the XML once I know exactly what you're after.

  • fgonzalez515 Profile Picture
    fgonzalez515 290 on at
    Re: EQUIVALENCES OF VARIOUS XML FILES FOR PARSE JSON

    Hi @grantjenkins 

     

    Thanks for your reply.
    I was able to solve Parse Json, with your solution.
    But since I want to make a Table with the data, I get this error when I use "Append to Array Variable".

    From what I see is that some XML in "Detalle" tells me array and others Object.
    How can I solve that?

     

    fgonzalez515_3-1697980605442.png

     

     

     

    fgonzalez515_2-1697980509104.png

     

     

     

    fgonzalez515_0-1697980431118.png

     

  • Verified answer
    grantjenkins Profile Picture
    grantjenkins 11,057 on at
    Re: EQUIVALENCES OF VARIOUS XML FILES FOR PARSE JSON

    You should ensure your schema caters for all scenarios - so includes all possible properties. However, you would likely need to remove any instances of required in the schema as this is likely what's causing the errors.

     

    So, in your schema, you may have instances such as that below which you should remove since some of the XML data doesn't include all properties.

     

    "required": [
     "NroLinDet",
     "CdgItem",
     "NmbItem",
     "DscItem",
     "QtyItem",
     "UnmdItem",
     "PrcItem",
     "MontoItem"
    ]

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard