Developer

CSV to JSON converter

Paste CSV to get JSON, or paste JSON to get CSV. Quoted fields, embedded commas, embedded line breaks and an optional header row are all handled.

Runs locally in your browser

How it works

The CSV parser reads character by character: inside double quotes a comma or a newline belongs to the field, and two quotes in a row mean one literal quote. With the header row ticked, the first line supplies the keys and every later line supplies values; short rows are filled with empty strings and a row with more fields than the header is reported by number. Turning JSON back into CSV takes the keys of the first object as the header and quotes any value containing a comma, a quote or a newline, doubling the quotes inside it. Input is capped at 200,000 characters and 2,000 rows, and both directions run locally.

Worked example

The three lines name,qty,price then Widget,3,2.50 then "Bolt, long",7,0.10 become a JSON array of two objects: name Widget with qty 3 and price 2.50, and name Bolt, long with qty 7 and price 0.10 — the comma inside the quotes stays in the name field. Values stay strings, so 2.50 keeps its trailing zero. Converting that JSON back with the header row ticked reproduces the original three lines exactly.

Questions and answers

Everything runs in your browser: your text, file or value is never uploaded anywhere.