0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Convert → Convert a CSV to JSON

AI-generated

Overview

This node provides a utility to convert CSV data into JSON format. It is particularly useful when you have CSV data (for example, exported from spreadsheets or databases) and need to process it as structured JSON within your n8n workflows. Common scenarios include transforming incoming CSV files for further automation, integrating with APIs that require JSON input, or preparing data for storage in systems that use JSON.

Practical examples:

  • Importing user lists from CSV and sending them to a CRM via API.
  • Converting product inventories from CSV to JSON for bulk updates.
  • Parsing CSV logs for analytics or reporting.

Properties

Name Meaning
CSV The raw CSV data to be converted. Paste the CSV content directly here.
Options Additional settings for the conversion process:
- Delimiter: Character used to separate columns. Set to "auto" to auto-detect.
- Trim CSV: Trim spaces around column values.
- CSV Headers: Indicate if the CSV lacks a header row.
- Ignore Empty Values: Skip empty column values.

Output

The output is a JSON array where each object represents a row from the original CSV. Each key corresponds to a column header (or a generated field name if headers are absent), and each value is the cell content from the CSV.

Example output:

[
  {
    "name": "Alice",
    "email": "alice@example.com"
  },
  {
    "name": "Bob",
    "email": "bob@example.com"
  }
]

If the "CSV Headers" option is enabled and the CSV has no header row, the keys will be generic (e.g., "field1", "field2", etc.).

Dependencies

  • External Service: Requires valid credentials for the "codeKitApi".
  • n8n Configuration: Ensure the node is configured with the appropriate API key or credentials for the CodeKit service.

Troubleshooting

Common issues:

  • Malformed CSV: If the CSV is not properly formatted (e.g., inconsistent columns), the conversion may fail or produce unexpected results.
  • Incorrect Delimiter: If the delimiter is set incorrectly, columns may not be parsed as expected. Use "auto" if unsure.
  • Missing Headers: If "CSV Headers" is enabled but the CSV actually contains headers, the first row will be treated as data, leading to incorrect field names.

Error messages:

  • "Invalid CSV format": Check your CSV for consistent columns and proper formatting.
  • "Authentication failed": Ensure your CodeKit API credentials are correct in n8n.

Links and References

Discussion