Skip to content

CSV to JSON Converter (and back)

CSV ↔ JSON with real RFC 4180 parsing, entirely in your browser.

Buğra SözeriDeveloper
Updated · Published

CSV looks trivial — values separated by commas — and that is exactly why so many converters get it wrong. Real-world CSV has quoted fields that contain commas, escaped quotes written as two double quotes, newlines embedded inside a single cell, and a zoo of delimiter dialects: Excel in most European locales exports with semicolons because the comma is the decimal separator. The parser below follows RFC 4180, the closest thing CSV has to a standard, and auto-detects comma, semicolon, or tab delimiters. Everything runs locally in your browser; your data never touches a server.

[ { "name": "Doe, Jane", "city": "Berlin", "zip": "10115" }, { "name": "Bob", "city": "Princeton", "zip": "08540" } ]

How to use

  1. Pick a direction

    CSV → JSON or JSON → CSV. Dropping a .csv or .json file onto the input switches the direction automatically.

  2. Paste or drop your data

    Paste text directly, or drag a .csv or .json file (up to 8 MB) onto the input box. The converted output appears as you type.

  3. Adjust the options

    Leave the delimiter on auto-detect unless it guesses wrong. Untick 'First row is header' for headerless data, and tick 'Infer types' only if your data has no leading zeros or long numeric IDs.

  4. Copy or download

    Use the copy button for quick pastes, or download the result as data.json or data.csv.

Frequently asked questions

Can I upload a file instead of pasting?
Yes — drag a .csv or .json file onto the input box. It is read locally with the browser's FileReader (up to 8 MB) and never uploaded anywhere. Dropping a .json file also flips the tool into JSON → CSV mode.
Why do numbers stay as strings by default?
Because silent coercion corrupts real data. A ZIP code like 08540 loses its leading zero the moment it becomes a number, and a 16-digit ID such as a card or account number exceeds JavaScript's safe-integer range (2^53) and gets rounded. Strings are lossless; enable 'Infer types' only when you know your columns are genuinely numeric or boolean.
My CSV uses semicolons — will it work?
Yes. Excel in German, French, Turkish, and most other European locales exports semicolon-separated files because the comma is the decimal separator there. The auto-detector scores comma, semicolon, and tab on the first data line and picks the winner; you can also force a delimiter from the dropdown.
What about newlines inside a cell?
Handled correctly. Per RFC 4180, a field wrapped in double quotes may contain line breaks, commas, and quotes (escaped by doubling). The parser tracks quote state across lines instead of naively splitting on newlines, which is where most quick-and-dirty converters break.
How is nested JSON converted to CSV?
CSV is flat, so nested objects and arrays cannot be represented natively. This tool serializes any nested value with JSON.stringify into its cell — an honest limitation rather than a lossy guess at flattening. If you need dotted-path column flattening, restructure the JSON first.
What happens with duplicate column headers?
Duplicate header names are deduplicated by suffixing an index: a second 'name' column becomes 'name_2', a third 'name_3', and so on. Without this, later columns would silently overwrite earlier ones in the resulting objects.

About

RFC 4180 in practice vs the dialects in the wild

RFC 4180 is an informational memo from 2005, not a strict standard, but it codified the sane core: fields separated by commas, records by CRLF, fields containing commas, quotes, or line breaks wrapped in double quotes, and literal quotes escaped by doubling. The wild disagrees on almost everything else — semicolon and tab delimiters, bare LF line endings, optional trailing newlines, byte-order marks from Excel, and headerless files. A robust converter accepts the dialects on input (this one auto-detects delimiters and accepts both CRLF and LF) while emitting strictly conformant output.

When CSV beats JSON, and vice versa

CSV wins for flat, tabular data: it is smaller, streams line by line, opens directly in Excel and Google Sheets, and loads into every database and dataframe library ever written. JSON wins the moment your data has structure — nesting, arrays of unequal length, typed values, or optional fields. It is also self-describing and unambiguous about strings versus numbers, which CSV fundamentally is not. A useful rule: if the data is a table, ship CSV; if it is a tree, ship JSON; if it is a table today but might grow structure, ship JSON and accept the size cost.

Sources & references

Authoritative references behind the math, constants, and tables on this page. Verified by Buğra Sözeri on the dates shown and re-checked at every deploy.

Related developer tools