CSV to JSON Converter

Convert CSV to JSON or JSON back to CSV, with correct quoted-field handling. Free, fast, and your files never leave your device.

Drag & drop a .csv or .json file here, or click to browse

CSV Input

JSON Output

A worked conversion

Paste this three-line CSV into the input box:

name,age,city
Ada,30,London
Grace,28,"New York, NY"

Press Convert with the delimiter on auto-detect and you get:

[
  {
    "name": "Ada",
    "age": "30",
    "city": "London"
  },
  {
    "name": "Grace",
    "age": "28",
    "city": "New York, NY"
  }
]

Two things to notice. The comma inside "New York, NY" stayed inside the value, because the parser tracks whether it is currently inside a quoted field rather than naively splitting on commas. And the header row became the object keys rather than a row of data. Output is indented with two spaces, and the status line underneath tells you how many rows were converted and which delimiter was used.

Every value comes out as a string, and that is deliberate

The converter does no type coercion whatsoever. 30 becomes "30", true becomes "true", and an empty cell becomes "". No value ever becomes a JSON number, boolean or null.

This is the single most useful thing about it if your data contains identifiers. A postcode of 0800, a phone number starting with 04, a product code of 007: every one of those loses its leading zeros the moment something decides it is a number. Spreadsheets do this constantly and so do many converters. Here they arrive intact, exactly as they appeared in the file.

The trade-off is that genuinely numeric columns come through quoted, so code expecting real numbers will need a cast. That is a much smaller problem than silently corrupted identifiers.

Spreadsheet exports: what is handled and what is not

Handled. Windows CRLF line endings are dealt with, because carriage returns are discarded during parsing and rows break on the newline. Fields containing commas, or newlines, or both, survive as long as they are quoted. A doubled quote inside a quoted field, which is how CSV escapes a literal quote character, is converted back to a single quote. A trailing newline at the end of the file does not produce a phantom empty row.

Not handled. A byte order mark. Excel commonly writes CSV files with a UTF-8 BOM at the very start, an invisible character before the first byte of real content. The parser does not strip it, so your first column ends up with an invisible character glued to the front of its name, and a lookup for name mysteriously fails while the output looks perfectly normal on screen. If your first key is behaving strangely, delete and retype the first header cell in the input box. Re-saving from Excel as plain "CSV (Comma delimited)" rather than the "CSV UTF-8" option also avoids it, though plain CSV will mangle non-English characters, so retyping the header is usually the safer fix.

Two more edge cases worth knowing. If a row has fewer fields than the header, the missing keys are filled with empty strings rather than being left out. If a header cell is blank, it is named col1, col2 and so on by position. And if two header cells have the same text, the later column wins, because they collide on the same object key.

Delimiter detection, and when to override it

Auto-detect looks at the first five lines, counts how many times each of comma, semicolon, tab and pipe appears, and picks the most frequent. A comma wins any tie.

It is wrong in one predictable situation: when a rarely used delimiter is common inside the data itself, such as free-text comments full of semicolons. If the row count looks wrong, or every record collapses into one field, set the delimiter manually and convert again.

Semicolon files are more common than people expect. In locales that use a comma as the decimal separator, spreadsheet software exports with semicolons by default, which is exactly the case auto-detect exists to catch.

Going the other way

The JSON to CSV tab takes a top-level array, either an array of objects or an array of arrays. Anything else, an object at the root or a bare value, is rejected with a message telling you so.

For an array of objects the header row is the union of every key seen across all records, in first-seen order, so records missing a key get an empty cell. Values are quoted only when they contain a quote, a comma or a line break, and rows are joined with CRLF.

One limit to plan around: CSV is flat and JSON is not. A nested object inside a record cannot be represented, and it will be written out as the literal text [object Object]. Flatten nested structures into top-level keys before converting, or export the nested part separately.

Note also that output in this direction is always comma-separated. The delimiter selector applies to reading CSV, not writing it.

Privacy and related tools

Everything runs in your browser, so your files never leave your device. Dropping a file on the drop zone reads it locally and fills the input box, which matters when the spreadsheet holds customer records.

Once you have JSON, the JSON Formatter and Validator will re-indent it, sort its keys or minify it. If your source is XML rather than CSV, use the XML to JSON Converter. To build realistic sample rows for testing a conversion, the Fake Data Generator produces CSV you can paste straight in, and Text Diff is handy for comparing two exports to see what actually changed.

Questions people ask

Why are my numbers wrapped in quotes?

Because no value is ever converted to a JSON number. It is a deliberate choice that protects leading zeros in postcodes, phone numbers and reference codes. Cast the columns you need as numbers after conversion.

My first column name does not match anything. What happened?

Almost certainly a byte order mark at the start of the file, which is invisible but still part of the first header cell. Retype that header cell in the input box and convert again.

What if my file has no header row?

Tick "output as array of arrays". You then get every row as a plain list of values, including the first one, with no keys involved.

Can it handle fields with line breaks inside them?

Yes, as long as the field is wrapped in double quotes, which is what the CSV convention requires. The parser stays inside the field until the closing quote.

Why was my JSON rejected when converting to CSV?

The input has to be an array at the top level. A single object, or an object wrapping an array under a key, needs to be unwrapped to just the array first.