CSV to JSON converter

Paste a CSV export and get JSON back, with quoted fields and embedded commas handled properly.

JSON

CSV looks like a format you can split on commas until the first person types a comma into an address field. Then the row shifts by one column, the shift is silent, and it only surfaces three steps later when a name has an email address in it. Paste the export here and it comes back as JSON that matches what the file actually says.

The parser reads the text one character at a time and keeps track of whether it is inside a quoted field, which is the only way to get this right. `"Smith, John"` stays one value. A quote inside a quoted field is written by doubling it, so `"said ""hi"""` becomes `said "hi"`. A quoted field may contain line breaks and still be one field, so the row count is a count of records, not of lines. CRLF and LF both work, a trailing newline does not invent an empty row, and a UTF-8 byte order mark at the start of the file is stripped rather than glued onto your first key.

It runs entirely in the page. The text you paste is never sent anywhere — there is no request to make, so exports with real names and addresses in them are safe to try. If the CSV you are converting is a spreadsheet of responses that someone re-exports by hand every week, formformform can skip that step: forms collect straight into structured data you can pull as JSON or CSV whenever you want it.

Quotes are the whole problem

A comma inside "Smith, John" is data, not a separator, and split(",") cannot tell the difference. This walks the text character by character with one bit of state — in a quoted field or not — and only treats a delimiter as a delimiter outside the quotes. A quote opens a field only at its start; anywhere else it is a literal character.

Doubling, not backslashes

RFC 4180 escapes a quote by writing it twice, so "" inside a quoted field means one " in the value. Backslash escapes are a JSON and shell convention, not a CSV one, and treating \" as an escape here would corrupt any Windows path in your data.

Semicolons, tabs and Excel

Excel in a European locale exports semicolon-separated files and often writes a sep=; line at the top to say so. That line is detected and used, or you can pick the delimiter yourself. Tab-separated files work through the same parser, quoting rules and all.

The first row becomes the keys

With the header option on, row one supplies the object keys: blank ones become column_2, and a repeated key is suffixed rather than allowed to overwrite its twin — you are told when either happens. Turn the option off and you get an array of arrays with nothing renamed.

Frequently asked questions

Why is every value a string?

Because CSV has no types, and guessing them loses data. Order 007 becomes 7, a phone number starting +44 turns into something unrecognisable, and 1-2 has been read as a date by more than one tool. Strings are what the file actually contains; casting the two columns you care about downstream is safer than having every column silently reinterpreted.

Can I convert a file instead of pasting?

Not here — this takes pasted text. Open the CSV in any text editor, select all, paste. Very large exports are the real limit: everything happens in one browser tab, so a file in the tens of megabytes is better handled by a script than by this page.

What if a row has more or fewer columns than the header?

Nothing is dropped. Missing trailing values become empty strings so every object has the same shape, extra values past the end of the header get numbered keys, and the mismatch is reported under the output. Ragged rows usually mean the quoting broke somewhere upstream, so the count is worth reading.

Does it handle a line break inside a field?

Yes, as long as the field is quoted, which is how a CSV is required to write one. A multi-line address stays a single value with its newlines intact, and the row counter counts it once. An unterminated quote — a stray " that never closes — is flagged, because from that point on the parser is reading the rest of the file as one very long field.

Other free tools

Want the form to collect the answers too?

Hand-written HTML still needs somewhere to post to. formformform gives you the form, the hosting, the responses and the notifications — free while we are in early access.

Start free