Skip to main content
Kinetic Community

Utility CSV to JSON

This handler converts a CSV string into a JSON string.

Downloads

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

utility_csv_to_json_v1.zip

Detailed Description

This handler assumes that the first row of values in the CSV input is a row
containing the column names. An exception will be raised to stop a potential
unsuccesful conversion if the first row has any blank values in it, if the
first row has duplicate values in it, or if a particular row has more values
than the first row.

===Example

Below is an example of a CSV input string and the corresponding JSON output
generated by this handler.

CSV Output
a,b,c,d,e
animal,boat,car,,
,,cat,dog,
,,,,eel


JSON Output
{ "table" :
    [
        {
          "a" : "animal",
          "b" : "boat",
          "c" : "car"
        },
        {
          "c" : "cat",
          "d" : "dog"
        },
        {
          "e" : "eel"
        }
    ]
}

Parameters

Name Description
CSV The CSV string to be converted to a JSON string.

Sample Configuration

Parameter Example Configuration
CSV <%=@answers['csv string']%>

Results

Name Description
JSON A JSON string that was converted from the given CSV.

Change Log

Version Date Description
V1 2012-5-31 Initial Version