-
Notifications
You must be signed in to change notification settings - Fork 8
Routes: CSV Parser
The CSV Parser Route
The CSV Parser route node is used to parse the CSV contents. The most common use is to read a CSV file using the CSV file reader node, and then route the message to the CSV parser to transform it into a JSON object, which is then must easier to transform than a CSV string object, which is what the CSV file reader produces.
The code block below documents the format for the CSV parser route node.
"route1": {
"type":"csvparser",
"dependencies":["route0","!listener"],
"csv_headers":["CustomerID","Customer","BalanceDuePat","PayerID","Payer","ClaimStatus"],
"trimValues": true
}
The csv_headers
property is used to indicate the header names for the CSV message. The JSON object created as properties whose names match the headers listed, and values match the content from parsing the CSV line.
The trimValues
property is used to automatically trim the values of the parsed CSV.
An example code block showing reading a CSV file and then parsing it is shown below.
"route0":{
"type": "csvfilereader",
"dependencies":["listener"],
"rowsPerParse": 10000,
"skip_first_row":true,
"donePath":"c:/users/user1/source/asb/done"
},
"route1": {
"type":"csvparser",
"dependencies":["route0","!listener"],
"csv_headers":["CustomerID","Customer","BalanceDuePat","PayerID","Payer","ClaimStatus"],
"trimValues": true
}
(C) 2018 - 2021 TekMonks