CSV: Decode Node
The CSV: Decode Node allows a workflow to decode a CSV string on the payload into an object array.
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. Default \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 (”).
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 which evaluate to invalid input will still error the workflow like so:
Related Nodes
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.