Table of Contents
This example demonstrates how to convert a JSON array of objects into an HTML table. The command processes the JSON data and generates an HTML table string that can be used in web pages, embedded in emails, or other HTML-supported environments.
You can use the following approaches to send the HTML table via email:
- Create an Email Action with a custom template in the SAP Alert Notification service, and then send the HTML table using the SendAnsEvent command.
- Directly send the HTML table using the SendEmail command with HTML formatting enabled.
There are no specific requirements to use this example, other than having a JSON array of objects as input data.
Import the content of the examples catalog into your Automation Pilot tenant. Navigate to the ConvertJsonToHtmlTable command and trigger it.
JSON Array Input
[
{
"name": "John",
"age": 30,
"city": "New York",
"state": "NY"
},
{
"name": "Jane",
"age": 25,
"city": "Los Angeles",
"state": "CA"
},
{
"name": "Tom",
"age": 35,
"city": "Chicago",
"state": "IL"
},
{
"name": "Sue",
"age": 40,
"city": "Houston",
"state": "TX"
}
]
HTML Table Result
age | city | name | state |
---|---|---|---|
30 | New York | John | NY |
25 | Los Angeles | Jane | CA |
35 | Chicago | Tom | IL |
40 | Houston | Sue | TX |
JSON Array Input
[
{
"name": "OS Memory Usage",
"state": "Ok",
"value": 42,
"unit": "%",
"timestamp": 1732608880000,
"output": "OK: MemoryValue: 42 (W> 98, C> 98) "
},
{
"name": "Disk I/O",
"state": "Ok",
"value": 65327,
"unit": "B/s",
"timestamp": 1732608880000,
"output": "OK: DiskRead: 0 B/s (W> 10000000, C> 15000000) DiskWrite: 65327 B/s (W> 10000000, C> 15000000)"
},
{
"name": "Average Response Time",
"state": "Ok",
"value": 0,
"unit": "ms",
"timestamp": 1732608880000,
"output": "JMX OK - AverageResponseTimeMin = 0ms "
},
{
"name": "Certificate Validity",
"state": "Ok",
"value": 729,
"unit": "days to expiration",
"timestamp": 1732608881000,
"output": "JMX OK - Alias = ajddef09eq; Thumbprint = BDD430E9BF9C12896C801848B5E834840B28F25C; ValidUntil = 2026-11-26T00:50:56Z; Expires in 729 days (W < 14 days, C < 7 days) "
},
{
"name": "Heap Memory Usage",
"state": "Ok",
"value": 12,
"unit": "%",
"timestamp": 1732608880000,
"output": "HeapMemoryUsage.used = 151 of 1183 MB "
},
{
"name": "Busy Threads",
"state": "Ok",
"value": 0,
"unit": "threads",
"timestamp": 1732608880000,
"output": "JMX OK - currentThreadsBusy = 0 (W > 150, C > 180) "
},
{
"name": "Requests per Minute",
"state": "Ok",
"value": 1,
"unit": "requests",
"timestamp": 1732608880000,
"output": "JMX OK - RequestsCountMin = 1 "
},
{
"name": "CPU Load",
"state": "Ok",
"value": 11,
"unit": "%",
"timestamp": 1732608880000,
"output": "OK CPUValue: 11 (W> 80, C> 90) "
},
{
"name": "Used Disc Space",
"state": "Ok",
"value": 22,
"unit": "%",
"timestamp": 1732608879000,
"output": "DISK OK - free space: / 8709 MB (76% inode=90%); /var 7152 MB (93% inode=99%); /tmp 3846 MB (99% inode=99%); /usr/sap 8705 MB (92% inode=99%);"
}
]
HTML Table Result
name | output | state | timestamp | unit | value |
---|---|---|---|---|---|
OS Memory Usage | OK: MemoryValue: 42 (W> 98, C> 98) | Ok | 1732608880000 | % | 42 |
Disk I/O | OK: DiskRead: 0 B/s (W> 10000000, C> 15000000) DiskWrite: 65327 B/s (W> 10000000, C> 15000000) | Ok | 1732608880000 | B/s | 65327 |
Average Response Time | JMX OK - AverageResponseTimeMin = 0ms | Ok | 1732608880000 | ms | 0 |
Certificate Validity | JMX OK - Alias = ajddef09eq; Thumbprint = BDD430E9BF9C12896C801848B5E834840B28F25C; ValidUntil = 2026-11-26T00:50:56Z; Expires in 729 days (W < 14 days, C < 7 days) | Ok | 1732608881000 | days to expiration | 729 |
Heap Memory Usage | HeapMemoryUsage.used = 151 of 1183 MB | Ok | 1732608880000 | % | 12 |
Busy Threads | JMX OK - currentThreadsBusy = 0 (W > 150, C > 180) | Ok | 1732608880000 | threads | 0 |
Requests per Minute | JMX OK - RequestsCountMin = 1 | Ok | 1732608880000 | requests | 1 |
CPU Load | OK CPUValue: 11 (W> 80, C> 90) | Ok | 1732608880000 | % | 11 |
Used Disc Space | DISK OK - free space: / 8709 MB (76% inode=90%); /var 7152 MB (93% inode=99%); /tmp 3846 MB (99% inode=99%); /usr/sap 8705 MB (92% inode=99%); | Ok | 1732608879000 | % | 22 |