Skip to main content
Kinetic Community

Utility JSON to HTML

This handler converts a JSON string into an HTML table string.

Downloads

By downloading this file, you acknowledge that you agree to our Terms of Service

Task 3: utility_json_to_html_v2.zip

Task 4: utility_json_to_html_v3.zip

Detailed Description

This handler makes some assumptions about the format of the JSON structure.  Itexpects an array of objects to be the value of the root of the JSON object.  Thishandler also expects the array of objects to contain only simple objects, not nested arrays or nested objects.

 
Below is an example of a JSON input string and the corresponding HTML output generated by this handler.
 
JSON Input
[
{
  "a" : "animal",
  "b" : "boat",
  "c" : "car"
},
{
  "a" : "cat",
  "b" : "dog"
},
{
  "c" : "eel"
}
]


HTML Output
<table><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>animal</td><td>boat</td><td>car</td></tr><tr><td>cat</td><td>dog</td><td></td></tr><tr><td></td><td></td><td>eel</td></tr></table>

 

This HTML String can be put into email, for example. 

 

Note that the JSON input must be in the format [{"label":"Value"},{"label":"Value"},{"label":"Value"}] with no additional levels or brackets.
 

Parameters

Name Description
JSON The JSON String to be converted to HTML.

Sample Configuration

Parameter Example Configuration
JSON <%=@answers['tableJSON']%>

Results

Name Description
HTML A HTML table that was converted from the given JSON

Change Log

Version Date Description
V1 2013-01-30

Initial Version

V2 2013-01-30 Removed sort and added border to table
V3 2016-09-27 Updated for different CSV version in Task 4 (because of different ruby version)