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 / HTML Table to JSON Arr...
Power Automate
Unanswered

HTML Table to JSON Array Resulting in Duplicated Data

(0) ShareShare
ReportReport
Posted on by 2

Hello all! Hoping someone can help me figure out where the issue is in my flow.

 

The flow grabs data from an HTML table embedded within an email, converts it to a JSON array which is then parsed so that I can populate specific values into List entries.

 

I've been able to successfully convert the table and populate the values into the list, but for some reason, it is duplicating values so that instead of one new item added to the list there are four new items. 

 

Here are the flow actions which happen once an email is received. Expression details are below

mbarron486_0-1686231418309.png

 

CompostTableStart - substring(triggerOutputs()?['body/body'], indexof(triggerOutputs()?['body/body'], '<table'))

ComposeTableEnd - substring(outputs('ComposeTableStart'),0,indexof(outputs('ComposeTableStart'),'</table>'))

ComposeAddCloseTableTag - output of CompostTableEnd </table>>

ComposeHTML - xml(replace(outputs('ComposeAddCloseTableTag'), '</colgroup>','</col></colgroup>'))

ComposeCountRowsMinusOne - int(xpath(outputs('ComposeHTML'), 'count(//tr)'))

SelectRowsFromHTML 

  • From - range(2,outputs('ComposeCountRowsMinusOne'))
  • Map:
    • First Name - xpath(xml(outputs('ComposeHTML')), concat('//table[1]//tr[1]/td[2]/text()'))?[0]
    • Last Name - xpath(xml(outputs('ComposeHTML')), concat('//table[1]//tr[2]/td[2]/text()'))?[0]
    • Phone Number - xpath(xml(outputs('ComposeHTML')), concat('//table[1]//tr[3]/td[2]/text()'))?[0]
    • ZIP Code - xpath(xml(outputs('ComposeHTML')), '//table[1]//tr[4]/td[2]/text()')?[0]

Parson JSON

  • Output of SelectRowsFromHTML
  • Schema: 
    {
        "type""array",
        "items": {
            "type""object",
            "properties": {
                "First Name": {
                    "type""string"
                },
                "Last Name": {
                    "type""string"
                },
                "Phone Number": {
                    "type""string"
                },
                "ZIP Code": {
                    "type""string"
                }
            },
            "required": [
                "First Name",
                "Last Name",
                "Phone Number",
                "ZIP Code"
            ]
        }
    }

I'm fairly certain the issue is happening somewhere in the ComposeHTML and SelectRowsFromHTML actions because I can see in the Outputs for SelectRowsFromHTML what appears to be the duplicated data:

mbarron486_1-1686232020991.png

Any thoughts for suggestions are appreciated!

Categories:
I have the same question (0)
  • FGirardi Profile Picture
    14 on at

    Hello @mbarron486,

     

    Do you mind to share each configuration of composes until parse it to Jason? I'm facing trouble to convert an HTML text from email to JSON.

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 67

#2
David_MA Profile Picture

David_MA 64 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 39 Most Valuable Professional

Last 30 days Overall leaderboard