Overview / Developer & Code / CSV ↔ JSON Converter
Developer & Code 100% In-Browser & Offline

CSV ↔ JSON Converter

Convert CSV to JSON or JSON to CSV with quoted fields, delimiter detection, typed values and row and column counts.

Paste or type your input; results appear instantly and errors are shown below the input.

Your files and input never leave your browser – nothing is uploaded.

Options

Typed values: numbers, true and false become JSON values and empty cells become null. Numbers with a leading zero (0042) stay text. Maximum input: 5,000,000 characters.

CSV to JSON when the commas are inside the data

A column called name holds "Smith, Anna". A plain split on commas cuts her in two and pushes every later cell one place to the right. This CSV to JSON converter reads the text the way RFC 4180 describes it: a field in double quotes may contain the delimiter, a doubled quote "" stands for one quote, and a line break inside quotes stays part of the field.

The same page works the other way. Switch the mode and it turns a JSON array into CSV.

Converting in four steps

  1. Click CSV → JSON or JSON → CSV. The input box already holds a small sample for that mode.
  2. Paste your data into the left box. The result appears on the right after a short pause.
  3. Set the options. For CSV: Delimiter, First row is the header, Trim values, Typed values and Indent. For JSON: Delimiter, Line ending and Quote every field.
  4. Press Copy, or press Download to save converted.json or converted.csv.

What the typed values switch changes

Off, every cell is a string, so a price comes out as "19.90". On, a cell that looks like a number becomes a number, true and false in any letter case become booleans, and an empty cell becomes null. Two guards protect your data. A number with a leading zero, such as 0042, stays text, so postcodes and product codes survive. An integer above 9,007,199,254,740,991 stays text too, because a JSON number would lose digits. Trim values runs first, so " 5 " becomes 5.

Delimiters, header rows and ragged lines

Auto-detect reads the first ten non-empty lines, ignores quoted text, and takes the delimiter that appears equally often on most of them. Comma wins when nothing fits. The line under the boxes names the delimiter it used and counts rows and columns.

A leading BOM is removed. CRLF and LF both work. Empty lines are skipped, and a final newline adds no row. A row that is shorter than the widest row gets empty strings (or null with typed values). Extra cells get the keys column_4, column_5 and so on, and so do empty header cells. Duplicate header names get a suffix: id, id_2. With the header switch off, the result is an array of arrays.

JSON to CSV: key union, nesting and quoting

An array of objects gives one column per key, in the order the keys first appear, so objects with different keys still line up. An array of arrays is written row by row without a header. One object becomes one row. Nested objects and arrays go into the cell as JSON text, and null becomes an empty cell, so null and an empty string look the same in the CSV. Fields with the delimiter, a quote or a line break are quoted, and Quote every field quotes all of them. The output has no final line break.

If the JSON is broken, the message gives the line and column of the first error.

Where the text goes

Parsing and conversion run in JavaScript on this page. No request is sent when you type or press a button; the network panel of your browser's developer tools shows this. The page does not store your input. Copy writes to the clipboard, and Download saves a file made from memory, without a BOM. Input above 5,000,000 characters is refused with a message.

Frequently asked questions (FAQ)

Put the field in double quotes, as in "Smith, Anna". The converter keeps the comma inside the value. Write a quote inside a quoted field as two quotes.