CSV ⇄ JSON Converter
Convert CSV to a JSON array of objects, or back, with proper quoted-field parsing.
Paste input on the left.
How it works
Both directions in one tool because they are one job in reverse — a spreadsheet export that a script needs to consume, or an API response a spreadsheet needs to open — and a form field's worth of switching between them beats keeping two tabs open.
Quoted fields are parsed properly
A regex split on comma is the usual shortcut for CSV, and it is wrong the moment a field contains one — an
address, a note, a name with a suffix. Parsing here follows RFC 4180: a quoted field may contain commas and
newlines, and "" inside a quoted field is an escaped quote, not the end of the field.
The CSV header is the union of every row's keys
Converting JSON → CSV, the header is built from every object in the array, not just the first one. A field only row 40 has still gets a column; rows without it get an empty cell rather than the field being silently dropped from the sheet.
Nested values become a JSON string in the cell
CSV has no representation for a nested object or array, so one is serialised into the cell as JSON text rather than flattened or dropped. It round-trips back through JSON.parse if you need the structure again; a spreadsheet will just show it as text.
Example
A CSV row of name,age then Alice,30 converts to a one-object JSON array holding
name and age, both as strings — CSV has no types, so a cell holding 30 is
indistinguishable from a cell holding the text 30.
Frequently asked questions
Why does a naive comma split get this wrong?
The moment a field contains a comma — an address, a free-text note — splitting on it breaks the row. This follows RFC 4180: a quoted field may contain commas and newlines, and "" inside a quoted field is an escaped quote rather than the field ending.
How is the CSV header decided when converting from JSON?
It is the union of every key seen across every object in the array, in first-seen order — not just the first row. A field only row 40 has still gets a column, with other rows left blank rather than the field being dropped from the sheet entirely.
Why are all my numbers quoted as strings after converting to JSON?
Because CSV never told this tool they were numbers. A cell holding 30 is indistinguishable from a cell holding the text "30" — there is no type information in CSV to recover, so every value comes through as a string and it is on you to cast the fields you know are numeric.
Related tools
JSON Formatter & Validator
Format, validate and measure JSON, with errors located by line and column.
LocalJSONL Formatter & Validator
Validate JSON Lines file by line and convert it to a single JSON array.
LocalCSV Linter
Check a CSV file for ragged rows and detect its delimiter, without converting it to anything.
LocalSQL Formatter
Reflow a SQL query onto readable lines, one clause per line.
LocalEnv File Converter
Convert between .env, JSON and YAML — the same config in three syntaxes.
Local.env Validator
Check a .env file for duplicate keys, invalid names and unterminated quotes.
Local