Forum Discussion

matt_bostrom's avatar
matt_bostrom
New Contributor II
8 years ago

Converting JSON to HTML Table for Email Snap

Hello. Let’s say I have JSON like the following:

[
{
“OwnerName”: “Mike Waltz”,
“OwnerEmail”: “mwaltz@testcompany.com”,
“LeadName”: “John Doe”,
“LastModifiedDate”: “2017-10-05T13:43:39.000+0000”
},
{
“OwnerName”: “Mike Waltz”,
“OwnerEmail”: “mwaltz@testcompany.com”,
“LeadName”: “Jane Smith”,
“LastModifiedDate”: “2017-10-05T18:32:46.000+0000”
}
]

How can I convert that into an HTML table to send in an email via the Email Sender Snap? Example is from an online source that does it to get the desired output from the JSON from this URL: Best Online JSON to HTML Converter:Display JSON into HTML format

5 Replies

  • del's avatar
    del
    Contributor III

    @matt.bostrom,
    In it’s simplest form, you can do something like this:

    With HTML table selected, the payload specified by the Table-data path is injected inside the <table></table> elements. You can add CSS to pretty it up as needed.

    • matt_bostrom's avatar
      matt_bostrom
      New Contributor II

      Hi Del. In this example it seems that its still only sending to 1 single email address even though I have the $groupBy.OwnerEmail in the TO variable of the email snap. I have it broken out into 2 groups and confirm that via the JSON i see multiple groupBy’s with emails yet its only sending one this way. Any ideas?

      • matt_bostrom's avatar
        matt_bostrom
        New Contributor II

        actually i believe its the “Batch Size” attribute that fixes this. When i change it from 100 to 1 it seems to behave the way I expect.

  • Preeta's avatar
    Preeta
    New Contributor II

    Hi,
    Using a similar scenario,but i don’t have a defined set of records to hardcode the table body . I can only hardcode the headers but will end up receiving multiple records. How can I address such a situation? @matt.bostrom @del

    Thanks,
    Preeta