N NotAtAll

How to Convert CSV to JSON Without Breaking Commas

By

CSV looks simple until a value contains a comma, a quote or a line break. Splitting every line on commas works for a toy file and silently corrupts real exports. A reliable conversion must understand quoted fields and must know whether the first row contains column names.

The shape of CSV-to-JSON output

With a header row, this CSV:

name,department,note
Ada,Research,"Works on parsing, testing, and docs"

becomes an array of objects:

[
  {
    "name": "Ada",
    "department": "Research",
    "note": "Works on parsing, testing, and docs"
  }
]

The first row becomes the object keys. Without a header row, the output is an array of arrays instead, so the first data row stays data rather than becoming field names.

Convert a CSV file or pasted export

  1. Open the CSV to JSON Converter.
  2. Paste the CSV text and choose the delimiter: comma, semicolon, tab or pipe.
  3. Leave Treat as header row enabled when the first row contains column names.
  4. Click CSV → JSON, review the output, and copy it.

The converter understands RFC-style quoted fields, including commas, escaped quotes and line breaks inside a value. That matters for addresses, descriptions, notes and spreadsheet cells that look like several columns but are actually one quoted field.

Watch the data types

CSV has no native number, boolean or date type. Values arrive as text, even when a cell contains 42, true or 2026-09-03. That is often the safest default because it preserves leading zeros in invoice numbers, ZIP codes and product IDs. Convert selected fields to numbers or dates later in the program that knows their schema.

Do not trim or coerce every value automatically. A product code such as 00127 is not the same as the number 127, and a long identifier can lose precision when it is treated as a JavaScript number. Keep the JSON strings until you know what each column means.

When the delimiter is not a comma

Some spreadsheet exports use semicolons because commas are used as decimal separators. Others use tabs or pipes. If every row appears to have one giant field, try another delimiter before editing the data by hand. The delimiter must match the file’s actual separator; changing it does not fix inconsistent rows.

When converting JSON back to CSV, the tool accepts an array of objects or an array of arrays. Nested objects and arrays become JSON text inside a cell, and values containing delimiters or line breaks are quoted and escaped for the CSV output.

Before sending the result to an API, run it through the JSON Formatter and check a few records against the source spreadsheet. The CSV to JSON tool runs locally in your browser, so private exports do not need to be uploaded for a format conversion.

Ready to try it?

CSV to JSON Converter (and back) — free and unlimited, right in your browser.

CSV ⇄ JSON Converter →

← More guides