Developer tool · free · runs in your browser

CSV to JSON Converter

Paste CSV or open a .csv file to get JSON you can copy or download. Quoted fields, embedded commas and line breaks are handled the way the CSV standard describes, and nothing is uploaded.

The file is read on this device, never uploaded.
Leaves values with leading zeros, such as 01234, as text.

What this CSV to JSON converter does

The converter reads comma-separated values, the format every spreadsheet and database can export, and turns them into JSON for an API, a configuration file, a test fixture or a script. By default the first row becomes the keys and every other row becomes an object. It detects the delimiter, follows the quoting rules of RFC 4180, reports malformed rows with line numbers, and can turn numbers and true/false into real JSON types.

How to convert CSV to JSON

  1. Paste CSV into the box, or open a .csv, .tsv or .txt file. The file is read on your device.
  2. Leave the delimiter on Auto-detect, or choose comma, semicolon, tab or pipe.
  3. Choose the JSON shape: an array of objects keyed by the header row, or an array of arrays that keeps every row, header included.
  4. Tick Convert numbers and true/false if you want typed values.
  5. Copy the JSON or download it as data.json.

CSV quoting rules

CSV looks simple until a value contains a comma. RFC 4180, the closest thing CSV has to a standard, sets these rules, and the converter follows them:

name,comment
"Smith, Jo","Said ""yes"" on the call"
"Lee","Line one
line two"

This sample has two records, not three. The second comment contains a real line break, which is allowed because it is inside quotes. The converter also removes a UTF-8 byte order mark at the start of the file, which Excel adds to CSV exports, and skips completely empty lines.

Type conversion

With the option ticked, a value becomes a number only if it is written as a plain JSON number: an optional minus, digits without leading zeros, an optional decimal part and exponent. So 42, -3.5 and 1e6 become numbers, while 01234, 1,000, $5 and 12 kg stay text. Integers above 9,007,199,254,740,991 also stay text, because JavaScript cannot store them exactly. true and false become booleans; empty fields stay empty strings.

Worked examples

A typical export

name,age,zip
"Smith, Jo",42,01234

With type conversion this becomes [{"name": "Smith, Jo", "age": 42, "zip": "01234"}]. The comma inside the quotes stays in the name, the age becomes a number and the ZIP code keeps its leading zero.

A European spreadsheet

A file exported with Excel set to German or French uses semicolons, because the comma is the decimal separator: a;b then 1,5;2. Auto-detect picks the semicolon and gives {"a": "1,5", "b": 2}. The value 1,5 stays text because JSON numbers use a decimal point.

A ragged file

If the header has 3 columns and line 7 has 4 fields, the extra value is kept under the key column_4 and a warning names the first line with a mismatch, so you can fix the source.

Tips and common mistakes

Limits and privacy

Input is limited to 10 MB. The output box shows up to 2 million characters, and the download always holds the complete JSON. Values are not trimmed, dates are not parsed and nested JSON is not built from dotted column names. The file never leaves your computer: it is read with the browser's File API and converted in the page.

Frequently asked questions

How does the converter handle commas inside a value?

Values that contain the delimiter, a quote or a line break must be wrapped in double quotes, for example "Smith, Jo". The converter reads them as one field, as RFC 4180 describes.

How do I put a double quote inside a CSV field?

Write it twice inside a quoted field: "He said ""hi""" becomes He said "hi". A single stray quote after a closing quote is reported as an error with its line number.

My file uses semicolons. Will it work?

Yes. Auto-detect counts commas, semicolons, tabs and pipes in the header line and picks the most common one. Spreadsheets set to languages that use a decimal comma often export semicolon-separated files.

Why are my numbers in quotes in the JSON?

CSV has no data types, so every value starts as text. Tick Convert numbers and true/false to turn plain numbers and true or false into JSON numbers and booleans.

Why did my ZIP code or ID stay as text?

On purpose. Values with leading zeros such as 01234, and integers too large to store exactly (above 9,007,199,254,740,991), stay as strings so they are not changed.

What happens with duplicate or empty column names?

Empty headers become column_1, column_2 and so on, and repeated names get a suffix such as id_2, so no value is lost.

How large a file can I convert?

Up to 10 MB of text. The output box shows the first 2 million characters and the download contains the full JSON.

Is my data uploaded?

No. The file is read with the browser's File API and converted on your device. The page makes no network requests.