csvStringToJSON

The csvStringToJson task converts a CSV string to JSON format.

Given an input table like this:

first_namelast_namepostalcodeenrolled
JaneSmith12345true
JohnWalkerfalse

The CSV should be structured like this (using semicolons as the field delimiter):

first_name;last_name;postalcode;enrolled
Jane;Smith;12345;true
John;Walker;;false

When a semicolon is matched, a new JSON entry is created. The resulting JSON is:

1[
2 {
3 "first_name": "Jane",
4 "last_name": "Smith",
5 "postalcode": "12345",
6 "enrolled": "true"
7 },
8 {
9 "first_name": "John",
10 "last_name": "Walker",
11 "postalcode": "",
12 "enrolled": "false"
13 }
14]

Properties

IncomingTypeDescription
inputStringInput CSV content to convert to JSON.
headersIncludedBooleanIndicates whether headers are included in the input.
headerRowArrayOptional array of headers to use for mapping.
OutgoingTypeDescription
responseStringThe CSV content converted to JSON format.

How to configure

Upload a CSV file with the input variables for the workflow. Set the input reference variable to the contents of the CSV file with a static variable source. Set headersIncluded to true.

You can convert a CSV file to Base64 format using a converter tool of your choice.

The response returned by this task contains the comma-separated values converted to JSON format. You can view the outgoing properties in Operations Manager when the task is complete.

Potential use case

If you are building a workflow and need to convert inputs to JSON format, upload a CSV file with the input variables instead of filling in a JSON form. After the csvStringToJson task converts the values to JSON, the variables can be queried from the output and used in further tasks.