CSV ⇄ JSON converter
Convert CSV to JSON and back. The first row is treated as headers.
How to use the CSV ⇄ JSON converter
- Pick a direction: CSV → JSON (the default) or JSON → CSV. Switching direction instantly re-converts whatever's in the box.
- For CSV input, make sure the first row is a header row — those names become the JSON keys. Quoted fields containing commas, line breaks or doubled quotes (
"") are parsed correctly. - For JSON input, paste a top-level array of objects, e.g.
[{"name":"Ada"}]— anything else stops with “JSON must be an array of objects.” - Click Convert. CSV becomes a 2-space-indented array of objects; JSON becomes comma-separated rows under a header line built from every key found across all objects.
- Click Copy to grab the result.
Common uses
- Turn an Excel or Google Sheets export into JSON fixtures for an app, a mock API or a database seed script.
- Flatten an API response or database dump (an array of objects) into CSV so a non-developer can open it in a spreadsheet.
- Untangle a messy CSV: converting to JSON makes it obvious where quoted commas and embedded line breaks actually split the fields.
- Reconcile inconsistent records — the JSON → CSV direction collects keys from every object, so a field that appears in only some records still gets its own column.
Tips & limitations
- The delimiter is the comma, full stop. Semicolon-separated files (common from European Excel installs) and tab-separated data come out as one giant column — re-export as real comma-separated CSV first.
- Every CSV value becomes a JSON string:
42arrives as"42"andtrueas"true". Convert types in your own code afterwards if they matter. - Rows shorter than the header are padded with empty strings, cells beyond the header's width are silently dropped, and duplicate header names collapse into one key (the right-most column wins).
- JSON → CSV doesn't flatten nesting: an embedded object becomes the literal text
[object Object]and an array becomes one comma-joined cell. Flatten nested structures into top-level keys before converting. - Line endings are normalized — Windows
\r\nand old-Mac\rboth work — and a trailing newline won't create a phantom empty record.
How it's built & why it's safe
CSV parsing is a small hand-written state machine — roughly 20 lines implementing RFC 4180-style quoting — and the JSON side is the browser's native JSON engine. Everything runs in the page: your data is never uploaded, which matters when the file is a customer list, payroll export or anything else you shouldn't paste into a random website. There are no row limits beyond your browser's memory, and nothing is stored — close the tab and the data is gone.
Related tools: JSON Formatter · YAML ⇄ JSON Converter · SQL Formatter
Further reading: JSON vs YAML vs CSV: choosing a data format
Frequently asked questions
How are CSV columns mapped to JSON?
The first row is read as headers, and each following row becomes one object with those header names as keys. Every value is kept as a string — numbers and booleans are not auto-converted, so cast types in your own code.
Does it handle commas and line breaks inside fields?
Yes. Fields wrapped in double quotes can contain commas, line breaks and escaped quotes written as two double quotes, exactly as spreadsheet apps export them. Windows and Mac line endings are normalized automatically.
Why did my semicolon-separated file convert into one column?
Only commas are treated as delimiters, and Excel in some locales exports with semicolons instead. Re-export choosing comma-separated CSV, or swap the delimiter first — carefully, since quoted fields can legitimately contain semicolons.
What JSON shape does JSON → CSV expect?
A top-level array of flat objects. The column list is the union of every key across all objects, in first-seen order; objects missing a key get an empty cell, and any other shape raises "JSON must be an array of objects."
Why do I see [object Object] in my CSV?
One of your records contains a nested object, and the converter doesn't flatten — it writes each value as-is. Flatten nested data into top-level keys (like user_name) before converting; arrays turn into a single comma-joined cell for the same reason.
Is my data uploaded anywhere?
No — parsing and conversion run entirely in your browser, and nothing is transmitted or stored. That makes it safe for exports containing real names, emails or financial rows.