Skip to main content

CSV: Decode Node

The CSV: Decode Node allows a workflow to decode a CSV string on the payload into an object array.

CSV: Decode Node

Node Properties

There are three main parts to the configuration of this node...

Input Path

This required field specifies the payload path where the CSV string to be decoded is located.

Format Configuration

This section contains four fields that specify the format of the incoming CSV string:

  • Record Delimiter: (Optional) This is the character used to separate rows of data. Leave blank to default to the newline character (\n).
  • Delimiter: (Optional) A string template to override the delimiter. This character is used to separate columns of data. Must be a single character. Leave blank to default to comma (,).
  • Quote: (Optional) A string template to override the quote character. Must be a single character. Leave blank to default to double-quote (").
  • Escape: (Optional) A string template to override the escape character. Must be a single character. Leave blank to default to double-quote (").
  • Strip the BOM (if it exists) from the start of the source string: (Optional) Enable this option to remove the Byte Order Mark (BOM) from the start of the CSV string, if it exists. This is useful when dealing with CSV files that may include a BOM, which can interfere with proper parsing. (Note: In edge workflows, this option is only available in GEA version 2.0.0 and higher.)

Result Path

This required field specifies the payload path where the decoded object array will be placed.

Node Example

In this particular instance, the workflow will decode the CSV string at the data.csvString path and place the resulting array of objects at data.out.

So, for the following input payload...

{
...
"data": {
"csvString": "Food,Drink\nBurger,Soda\nTaco,Water\n"
}
...
}

The CSV: Decode Node would give the following output payload.

{
...
"data": {
"csvString": "Food,Drink\nBurger,Soda\nTaco,Water\n",
"out": [
{
"Drink": "Soda",
"Food": "Burger"
},
{
"Drink": "Water",
"Food": "Taco"
}
]
}
...
}

Node Errors

The following is an example of a failed operation:

{
"error": {
"message": "Invalid opening quote at line 1"
}
}

Templates and paths that evaluate to invalid input will still error the workflow like so:

CSV: Decode Node Error

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.