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

The CSV: Decode Node's configuration is broken up into the following sections:

Input Path

This section specifies the source data for the CSV string to be decoded.

  • Encoded String Path: The payload path where the CSV string to be decoded is located.

Configuration

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

  • Character to Separate Rows of Data: (Optional) This is the character used to separate rows of data. Leave blank to default to the newline character (\n).
  • Template for Delimiter: (Optional) A string template for the delimiter character used to separate columns of data. Must resolve to a single character. Leave blank to default to comma (,).
  • Template for Quote Character: (Optional) A string template for the quote character. Must resolve to a single character. Leave blank to default to double-quote (").
  • Template for Escape Character: (Optional) A string template for the escape character. Must resolve to 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: For Edge Workflows, this option is only available in GEA version 2.0.0 or higher.)

Result Path

This section specifies the destination for the decoded data.

  • Decoded Result Path: 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: a quote is found on field 1 at line 1, value is \"fieldTwo\""
}
}

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.