Skip to content

Read CSV file into structured data

The “Read CSV file into structured data” service task automatically converts a CSV file into an array of JSON objects. Optionally you can rename columns via a mapping and convert data types such as float, date, or boolean.

Input parameters

Provide the following fields as task input:

{
  "csv_file": {
    "referenceId": "string",
    "filename": "file.csv"
  },
  "config": {
    "delimiter": ";"
  },
  "column_mapping": {
    "Amount": "amount",
    "Value date": "valueDate"
  },
  "field_mapping": {
    "amount": { "type": "float" },
    "valueDate": { "type": "date", "format": "dd.MM.yyyy" }
  }
}

Explanation:

  • csv_file: Reference to the uploaded CSV file (must be available as fileReference).
  • config: Optional configuration object for the CSV import (supported options: delimiter, header, skipEmptyLines, dynamicTyping).
  • column_mapping: Optional object to rename CSV headers. Key = original column name, value = target name in JSON.
  • field_mapping: Optional object to convert individual field types. Supported types: string, int, float, date, boolean. For date fields you can additionally define a format (e.g., dd.MM.yyyy).

Output

The task returns the parsed records as JSON:

{
  "status": 200,
  "records": [
    {
      "amount": 177.5,
      "valueDate": "2025-03-07"
    },
    ...
  ],
  "total": 42
}

Explanation:

  • status: HTTP status code.
  • records: Array containing the parsed JSON objects.
  • total: Number of rows (records).

JSONata examples

// Example: map amount and value date dynamically from process data
{
  "column_mapping": {
    "Amount": "amount",
    "Value date": "valueDate"
  },
  "field_mapping": {
    "amount": { "type": "float" },
    "valueDate": { "type": "date", "format": "dd.MM.yyyy" }
  }
}

Notes

  • Only csv_file is required; config, column_mapping, and field_mapping are optional.
  • Empty lines are skipped automatically.
  • Date fields are returned in YYYY-MM-DD (ISO) if the format matches.
  • Numbers with a comma (177,50) are recognized correctly.

Tip

Use the JSONata Playground to test and validate expressions.