Skip to content

Latest commit

 

History

History

convert-json-to-html-table

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Convert JSON to HTML Table

Table of Contents

Description

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:

Requirements

There are no specific requirements to use this example, other than having a JSON array of objects as input data.

How to use

Import the content of the examples catalog into your Automation Pilot tenant. Navigate to the ConvertJsonToHtmlTable command and trigger it.

Examples

Basic Example

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

agecitynamestate
30New YorkJohnNY
25Los AngelesJaneCA
35ChicagoTomIL
40HoustonSueTX

Advanced Example

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

nameoutputstatetimestampunitvalue
OS Memory UsageOK: MemoryValue: 42 (W> 98, C> 98) Ok1732608880000%42
Disk I/OOK: DiskRead: 0 B/s (W> 10000000, C> 15000000) DiskWrite: 65327 B/s (W> 10000000, C> 15000000)Ok1732608880000B/s65327
Average Response TimeJMX OK - AverageResponseTimeMin = 0ms Ok1732608880000ms0
Certificate ValidityJMX OK - Alias = ajddef09eq; Thumbprint = BDD430E9BF9C12896C801848B5E834840B28F25C; ValidUntil = 2026-11-26T00:50:56Z; Expires in 729 days (W < 14 days, C < 7 days) Ok1732608881000days to expiration729
Heap Memory UsageHeapMemoryUsage.used = 151 of 1183 MB Ok1732608880000%12
Busy ThreadsJMX OK - currentThreadsBusy = 0 (W > 150, C > 180) Ok1732608880000threads0
Requests per MinuteJMX OK - RequestsCountMin = 1 Ok1732608880000requests1
CPU LoadOK CPUValue: 11 (W> 80, C> 90) Ok1732608880000%11
Used Disc SpaceDISK 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%);Ok1732608879000%22