Convert to CSV

Takes an array of objects (a tabular dataset) and converts it into a CSV file.

InputOutput
  • Any (JSON)
  • Required: Array of Objects (Dataset)
  • Any (JSON) (Passthrough)
  • CSV Data (string)

For example, given the following dataset:

[
{
"Make": "Toyota",
"Model": "Camry",
"Year": 2020,
"Price": 24000
},
{
"Make": "Honda",
"Model": "Civic",
"Year": 2019,
"Price": 22000
},
{
"Make": "Ford",
"Model": "Mustang",
"Year": 2021,
"Price": 27000
}
]

The following CSV dataset will be generated:

"Make","Model","Year","Price"
"Toyota","Camry","2020","24000"
"Honda","Civic","2019","22000"
"Ford","Mustang","2021","27000"

Input object

{
"myData": [
{
"Make": "Toyota",
"Model": "Camry",
"Year": 2020,
"Price": 24000
},
{
"Make": "Honda",
"Model": "Civic",
"Year": 2019,
"Price": 22000
},
{
"Make": "Ford",
"Model": "Mustang",
"Year": 2021,
"Price": 27000
}
]
}

Output object

Assumes that the β€œOutput Property” name has been changed to β€œmyCsvData”.

{
"myData": [
{
"Make": "Toyota",
"Model": "Camry",
"Year": 2020,
"Price": 24000
},
{
"Make": "Honda",
"Model": "Civic",
"Year": 2019,
"Price": 22000
},
{
"Make": "Ford",
"Model": "Mustang",
"Year": 2021,
"Price": 27000
}
],
"myCsvData": ""Make","Model","Year","Price"\n"Toyota","Camry","2020","24000"\n"Honda","Civic","2019","22000"\n"Ford","Mustang","2021","27000""}

Properties

The following properties relateto converting to CSV:

NameTypeTemplatableNotes
Field DelimiterChoice:
  • Comma (,)
  • Tab (\t)
  • Pipe (|)
  • Semicolon (;)
  • Other
NoSelect the field delimiter character. For CSV files, this is usually a comma.
Custom DelimiterTextNoOnly visible if Field Delimiter is "Other". Enter one or more characters to use as the field delimiter.
Line DelimiterChoice
  • CRLF (\r\n)
  • LF (\n)
NoChoose whether you want Windows (CRLF) or Unix (LF) style line endings.
Input ArrayTextYesEnter an expression pointing to an array of objects to use as the input for the CSV data. Use the "array" function to cast the data as an array. Example: {{ input.myData | array }}
Output PropertyTextNoSpecify the name of the property to store the CSV data in.

Did this page help you?