devtools

CSV to JSON Converter

Convert CSV to JSON in your browser: RFC 4180 quoting, custom delimiters, and header-to-object mapping. Private and offline — your data never leaves the page.

Runs entirely in your browser — your data never leaves your device.

How to use CSV to JSON Converter

What it does & when you need it

You exported a spreadsheet or pulled a report from some internal dashboard, and now you need it as JSON to seed a database, feed a test fixture, or POST it to an API. This converter reads CSV and emits pretty-printed JSON — an array of objects when the first row holds column names, or an array of string arrays when it doesn't. It parses the file the way the format actually works (quoted fields, embedded commas and newlines, escaped quotes), not with a naive comma split, and it does all of it in your browser, so a spreadsheet full of customer emails or salaries never leaves your machine.

How to use

  1. Paste your CSV into the input.csv buffer, press Sample to load an example, or Upload a .csv/.tsv file.
  2. Pick the Delimiter that matches your data (comma, semicolon, tab, or pipe) and tick First row is header if row one contains column names.
  3. Read the JSON in the output.json buffer — it updates as you type. The status bar shows how many records were produced, or points out a parse problem such as an unclosed quote.
  4. Press Copy JSON or Ctrl/Cmd + Enter to copy the result. Need it indented differently or re-validated afterwards? Send it to the JSON Formatter.

Things worth knowing

There is a spec, and this tool follows it. CSV was informally standardized late as RFC 4180. The rules that matter: any field containing the delimiter, a double quote, or a line break must be wrapped in double quotes, and a literal double quote inside such a field is written as two quotes (""). That is why "Doe, John" stays one field and "He said ""hi""" decodes to He said "hi".

Never parse CSV with String.split(','). It is the classic bug: it looks fine on toy data and then corrupts the first row that contains a quoted comma ("Amsterdam, NL") or a newline inside a quoted cell. Once a field can contain the delimiter, you need a real state machine that tracks whether you are inside quotes — which is exactly what this parser does.

The delimiter is not always a comma. Many European locales export with a semicolon because the comma is their decimal separator (3,50 means three euros fifty). Files from those systems will look like a single giant column until you switch the delimiter to ;. Tab-separated (TSV) and pipe-delimited exports are common too, so the delimiter selector covers all four.

Watch for an invisible byte-order mark. Excel and some Windows tools prepend a UTF-8 BOM (U+FEFF) to the file. Left in place it becomes stray characters glued to your first header — you get a key like id instead of id, which then breaks every downstream lookup. This tool strips a leading BOM before parsing so the first column name is clean.

Values stay as strings. CSV has no type system, so 36 and true come through as the strings "36" and "true" rather than a number or boolean — coercing them would guess wrong on ZIP codes, phone numbers, and leading zeros. Cast the fields you actually need on the consuming side. If your target format is different, the YAML to JSON converter follows the same in-browser approach for config files.

Examples

Header row to array of objects

id,name,email,active
1,Ada Lovelace,ada@example.com,true
2,Grace Hopper,grace@example.com,false

With header enabled, each row becomes an object keyed by id, name, email, and active.

Quoted commas and embedded newlines

name,note
"Doe, John","line one
line two"
quip,"He said ""hi"""

RFC 4180 quoting keeps the comma and newline inside the field and unescapes the doubled quotes.

Semicolon-delimited (European export)

product;price;in_stock
Widget;3,50;true
Gadget;12,00;false

Switch the Delimiter selector to Semicolon so the decimal-comma prices stay in the price column.

Frequently asked questions

How do I turn a CSV header row into JSON object keys?

Keep the "First row is header" option enabled. The first row is read as column names and every following row becomes an object keyed by those names. Turn it off to get a plain array of string arrays instead.

Why does my CSV come out as one big column?

The delimiter doesn't match your file. Files exported in many European locales use a semicolon because the comma is their decimal separator, and some use tabs or pipes. Switch the Delimiter selector to match and the columns split correctly.

Does it handle commas and line breaks inside a field?

Yes. The parser follows RFC 4180, so a field wrapped in double quotes can contain the delimiter, newlines, and escaped quotes (a literal quote written as two quotes). A value like "Doe, John" stays a single field rather than splitting.

Are numbers and booleans converted to real JSON types?

No. CSV has no type information, so every value comes through as a string — 36 becomes "36" and true becomes "true". This avoids corrupting ZIP codes, phone numbers, and IDs with leading zeros; cast the fields you need on the consuming side.

Is my CSV uploaded anywhere?

No. Parsing runs entirely in your browser with JavaScript, so nothing you paste or upload is transmitted. It keeps working offline once the page has loaded.