CSV ↔ JSON

Convert CSV and JSON, handling quoted and multiline fields.

A spreadsheet export lands on your desk and the API you're feeding it to wants JSON. Or the reverse: an endpoint returns an array of objects and someone in finance wants it in Excel.

This converter goes both directions and, unlike a quick split-on-comma script, it respects CSV quoting — so a value like "Seoul, Korea" stays one field instead of becoming two.

How it works

CSV → JSON

Paste your CSV and press CSV → JSON. The checkbox controls the output shape:

  • First row as header ticked — you get an array of objects, with the first row supplying the keys.
  • Unticked — you get an array of arrays, every row treated as data.

Rows with fewer cells than the header get empty strings for the missing keys, so the object shape stays consistent.

JSON → CSV

The input must be a top-level array. Two shapes are handled:

  • Array of objects — the keys of the first object become the header row, and every later row is read against that same key list.
  • Array of arrays — written out row for row, no header inference.

Anything else (a bare object, a number, an array wrapped in an outer object) returns a parse error.

How quoting is handled

InputResult
"Seoul, Korea"one field containing a comma
"she said ""yes"" then left"one field containing literal quote marks
a quoted value with a line breakone field spanning two lines

Carriage returns are discarded, so files saved with Windows CRLF line endings work without conversion. Going the other way, any value containing a comma, a quote or a newline is automatically wrapped in quotes with its inner quotes doubled — the RFC 4180 convention that Excel and Google Sheets both read.

Things to check first

Commas are the only delimiter, so semicolon- or tab-separated exports need converting first. Nested objects and arrays have no CSV equivalent and stringify into unusable text, so flatten them before converting. And if your objects have inconsistent keys, keys that are absent from the first object will not appear in the output at all. Everything runs locally in the browser — nothing is uploaded.

Terms explained

First row as header
When ticked, the opening CSV row is read as field names rather than data, producing an array of objects instead of an array of arrays.
Quoted field
A value wrapped in double quotes so it can safely contain commas, line breaks or quote characters.
Escaped quote
Two double quotes in a row inside a quoted field, which represent one literal quote character.
Array of objects
The JSON shape most APIs return — a list where each entry is a record with named keys. This is what the header option produces.
RFC 4180
The commonly followed CSV convention this tool applies: comma delimiter, double-quote wrapping, and doubled quotes for escaping.

Frequently asked questions

Why did my CSV column split into two?

Almost always because a value contains a comma but was not wrapped in double quotes when the file was written. Re-export from your spreadsheet program with quoting enabled, or add the quotes by hand, and the field will stay intact.

Can it read semicolon or tab separated files?

Not directly — the parser is fixed to commas, which is what most exports outside continental Europe use. Replace the delimiter with commas first, taking care that your data does not already contain commas, or re-export as comma-separated from the source application.

Why are some keys missing from my CSV output?

The header row is built from the keys of the first object in the array. If later objects carry extra keys, those columns are not created. Reorder so that the most complete record comes first, or normalise the objects so every one has the same keys.

What happens to nested JSON?

Nested objects and arrays are converted to text and typically come out as `[object Object]`, which is not useful. Flatten the structure first — for example turn `{"user":{"name":"Kim"}}` into `{"user_name":"Kim"}` — before converting.

Is my data uploaded anywhere?

No. Both conversions run entirely in your browser using JavaScript, so the text you paste never leaves your device. That makes it safe for internal exports you would not want to send to a remote service.