Convert JSON to CSV
Convert JSON array data to CSV format and save as a file
Convert JSON to CSV
Convert an array of JSON objects to CSV format and save it as a file. This function automatically extracts headers from the JSON data and handles missing fields across rows.
Technical Name: JsonToCsvFileConverter
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: System Functions
- Function ID:
7f9a1ea8-5d9a-4f2b-a8f6-8f6b5d9a1ea4
Input Schema
Required Parameters
| Parameter | Type | Description |
|---|---|---|
data | array | Array of JSON objects to convert to CSV. Each object represents a row, and object keys become column headers |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
fileName | string | Name of the CSV file to generate (default: "export.csv") |
includeDateInFilename | string | Whether to include date in filename - "true" or "false" (default: "true") |
includeHeader | string | Whether to include headers in CSV - "true" or "false" (default: "true") |
[Image placeholder: JsonToCsv function configuration panel]
Input Example
Basic Conversion
{
"data": [
{
"name": "John Doe",
"email": "john@example.com",
"age": 30
},
{
"name": "Jane Smith",
"email": "jane@example.com",
"age": 25
}
],
"fileName": "users.csv"
}Without Headers
{
"data": [
{"product": "Widget A", "price": 19.99, "quantity": 100},
{"product": "Widget B", "price": 29.99, "quantity": 50}
],
"fileName": "products.csv",
"includeHeader": "false",
"includeDateInFilename": "true"
}With Date in Filename
{
"data": [
{
"orderId": "ORD001",
"customer": "Acme Corp",
"amount": 1500.00,
"status": "completed"
},
{
"orderId": "ORD002",
"customer": "Tech Inc",
"amount": 2300.50,
"status": "pending"
}
],
"fileName": "orders_export.csv",
"includeDateInFilename": "true",
"includeHeader": "true"
}Output Schema
| Field | Type | Description |
|---|---|---|
fileId | string (uuid) | ID of the generated CSV file in the file storage system |
fileName | string | Name of the generated CSV file (includes date suffix if enabled) |
rowCount | integer | Number of rows in the exported file |
Output Example
{
"fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
"fileName": "users_export_20240120_143022.csv",
"rowCount": 2
}[Image placeholder: CSV output visualization]
How It Works
- Extracts Headers: Automatically collects all unique keys from all JSON objects to create column headers
- Handles Missing Fields: If a row doesn't have a field present in other rows, it's filled with an empty string
- Converts Values: All values are converted to strings for CSV format
- Generates File: Creates CSV file and uploads it to file storage
- Date Suffix: Optionally appends timestamp to filename (format:
yyyyMMdd_HHmmss)
Use Cases
Convert API Response to CSV
Convert JSON API response data to CSV:
{
"data": [
{"id": 1, "name": "Item 1", "value": 100},
{"id": 2, "name": "Item 2", "value": 200}
],
"fileName": "api_data.csv"
}Export Workflow Results
Export workflow execution results to CSV:
Start → ProcessData → JsonToCsv → EmailNotification(attach CSV) → EndTransform Data Before Export
Transform and convert data:
Start → FetchMData → TransformData → JsonToCsv → End[Image placeholder: Workflow examples]
Related Functions
- Export Data to CSV - Execute a query and export results to CSV
- EmailNotification - Send generated CSV files via email