File Converters

CSV to JSON Converter

Convert CSV text to JSON format with custom delimiters, header detection, and adjustable indentation.

Run tool

This CSV to JSON converter transforms structured tabular data into standard JSON text. Paste comma-separated or custom-delimited values into the input field to generate formatted JSON objects or arrays. By default, the converter treats the first line as column headers, trimming surrounding whitespace from header names and field values so each matching row becomes a clean key-value object.

You can customize the field delimiter to process comma or semicolon records, and adjust the indentation level to output compact or readable JSON structures. When header processing is disabled, every line converts into an ordered array of row values. If a row contains a different count of fields than the header line, the converter preserves the mismatched line as row values rather than discarding the entry. Empty or whitespace-only inputs return a prompt to enter valid tabular text for conversion.

Instructions

  1. Paste or type your CSV text into the input field.
  2. Specify the delimiter character if your data uses semicolons or custom separators instead of commas.
  3. Leave the header option checked to treat the first line as object keys, or uncheck it to produce arrays of row values.
  4. Set your desired spacing in the indent field to adjust JSON formatting.
  5. Click the run button to generate your formatted JSON output.

Examples

  • Input CSV with headers: name, age, city Alice, 30, New York Bob, 25, Chicago Result with default settings (delimiter ',', header enabled, indent 2): [ { "name": "Alice", "age": "30", "city": "New York" }, { "name": "Bob", "age": "25", "city": "Chicago" } ]
  • Input semicolon-delimited CSV without headers: ItemA; 15; in_stock ItemB; 30; out_of_stock Result with delimiter ';' and header disabled: [ [ "ItemA", "15", "in_stock" ], [ "ItemB", "30", "out_of_stock" ] ]

FAQ

How does the tool handle whitespace around field names and values?

When header handling is active, leading and trailing whitespace is automatically removed from column headers and cell entries before creating JSON keys and values.

What happens if a row has fewer or more fields than the header row?

Rows that do not match the column count of the header row are included in the JSON output as arrays of raw row values instead of key-value objects.

Can I convert files separated by semicolons rather than commas?

Yes. Enter a semicolon in the delimiter field before running the conversion to parse semicolon-delimited tabular data properly.

What happens if the input is left blank or contains only whitespace?

The tool requires non-empty CSV text. If you submit empty or whitespace-only content, the tool indicates that valid input is needed rather than generating output.

Embed this tool

Add this working SmartPlusLab tool to your website with the code below.