CSV to JSON Converter (and JSON to CSV)

Paste CSV or drop a file and get JSON — flat, nested, JSONL, or keyed — with types inferred sensibly and overridable per column. Flip the direction for JSON to CSV, or generate SQL INSERT statements from the same data. This is a CSV to JSON converter online in the narrow sense that it's a web page: your data is parsed by JavaScript in this tab and never uploaded anywhere.

To convert CSV to JSON, each row becomes an object whose keys come from the header row. id,name,active
1,Ada,true
2,Bo,false
[{"id": 1, "name": "Ada", "active": true},
 {"id": 2, "name": "Bo", "active": false}]
Drop a .csv / .txt / .json file here, or click to choose — it's read locally, never uploaded.
Parsing…
[ Ad slot — replace with AdSense / Ezoic code ]

Large files & privacy: nothing leaves this tab

Most online CSV converters are upload services with a textarea in front. Your paste — which is often a customer list, a payroll export, or an API dump full of tokens — travels to a server, gets processed there, and lives in someone's logs for an undisclosed amount of time; at least one popular converter has made pasted data publicly reachable by URL. This page is the other architecture: the file API reads your file into the tab's memory, JavaScript parses it there, and the output exists only on your screen until you copy or download it. There is no upload endpoint to send data to. You can load the page, disconnect from the internet, and everything still works.

That design also sets the size ceiling honestly: it's your machine's memory, not a server plan. Multi-megabyte files parse with a progress bar (a background worker keeps the page responsive); files in the tens of megabytes work on typical hardware. Beyond that, browser memory limits apply — if you need to break a giant file down first, that's exactly what our CSV splitter is for.

Type detection you can argue with

Naive converters make every value a string, which means "age": "42" and a second pass of cleanup in your code. Aggressive converters convert everything that looks numeric, which is how ZIP code 00501 becomes the number 501 and a phone number loses its leading zero. This tool takes a middle path with explicit rules:

Nested JSON from dotted and bracketed headers

Flat objects are the default, but CSV headers can describe structure: a header of user.address.city means "put this inside user, inside address". Choose the Nested objects output mode and dotted headers build real nesting, while bracketed headers build arrays — tags[0] and tags[1] become a two-element tags array. This is the round-trip partner of flattening: if you exported nested JSON to a spreadsheet using dotted keys (our JSON utilities page does exactly that), this mode reassembles the original shape.

user.name,user.address.city,tags[0],tags[1] Ada,Oslo,admin,ops
[{"user": {"name": "Ada", "address": {"city": "Oslo"}}, "tags": ["admin", "ops"]}]

The other output modes cover the remaining shapes real code wants: JSONL writes one object per line for log pipelines and bulk-import endpoints; keyed object turns a chosen column into the top-level keys (handy for lookup tables — duplicate keys keep the last row and you get a warning); and arrays of arrays is for headerless files where positions, not names, carry the meaning.

JSON to CSV, same page, reverse gear

Switch the direction and paste JSON — an array of objects, a single object, or JSONL — and you get CSV back. Nested keys flatten to dotted headers (user.address.city), arrays inside objects become bracketed headers, and the column set is the union of keys across all objects in first-seen order, so ragged API responses don't lose fields. Output quoting follows RFC 4180: any value containing the delimiter, a quote, or a newline gets wrapped in double quotes, and quotes inside values are doubled. You choose the delimiter (comma, semicolon, tab, pipe), the line ending (CRLF as the spec prescribes, or LF), and whether to prepend a UTF-8 BOM — the three bytes that stop spreadsheet applications from displaying é where é should be.

CSV to SQL INSERT statements

The third output this page generates is SQL: paste or load a CSV, name the target table, and get INSERT statements ready to run. This isn't string concatenation with fingers crossed — the details that break naive generators are handled:

Semicolons, tabs, and the European Excel problem

"CSV" rarely means comma-separated in practice. Spreadsheet software on a system with European regional settings exports with semicolons, because the comma is the decimal separator (3,14) and can't also delimit fields. Database dumps and clipboard pastes are frequently tab-separated; pipe-delimited files turn up in legacy feeds. The delimiter selector defaults to auto-detect — the first rows are sniffed, quoted sections excluded, and the most frequent candidate among comma, semicolon, tab, and pipe wins — with a manual override for the files that fool sniffing, like a single-column file containing addresses full of commas.

CSV quoting rules, in one place

These are the parsing rules this tool implements, paraphrased from the CSV conventions standardized in RFC 4180 — they're also the checklist for debugging a "broken" CSV by hand:

What this tool doesn't do (on purpose or honestly)

No spreadsheet formula evaluation: a cell containing =SUM(A1:A9) converts as the literal text, because this is a parser, not a spreadsheet engine. No XLSX: Excel workbooks are ZIP archives of XML, a different format entirely — export to CSV first; for cleaning up marketplace CSV exports specifically, see our Shopify CSV cleaner. Character encoding is assumed UTF-8 (a leading BOM is tolerated and stripped); files in legacy encodings like Windows-1252 may show mojibake for accented characters — re-save as UTF-8 and reload. And the parser is strict about structure but forgiving about mess: it will warn about ragged rows and unclosed quotes rather than refusing to work.

[ Ad slot — replace with AdSense / Ezoic code ]

Related tools

Frequently asked questions

Is my CSV uploaded to a server?

No. The file is read by the browser's file API and parsed by JavaScript in this tab. There is no upload endpoint on this page — you can verify with your browser's network inspector, or load the page and go offline before pasting.

Why did my ZIP codes keep their leading zeros?

Because the type inference deliberately refuses to convert values like 00501 to numbers — a leading zero followed by more digits marks an identifier, and identifiers must stay strings. If you actually want them numeric, set that column's type to Number in the per-column controls.

How do I get nested JSON instead of flat objects?

Name your columns with dots or brackets — user.address.city, tags[0] — and pick the Nested objects output mode. Dots build objects, bracketed numbers build arrays, and the two combine (items[0].sku).

Can it convert JSON back to CSV?

Yes — switch Direction to JSON → CSV. Arrays of objects, single objects, and JSONL all work; nested keys flatten to dotted headers, and quoting, delimiter, line endings, and an optional UTF-8 BOM are all configurable.

My file uses semicolons — is that still CSV?

In the wild, yes. Spreadsheet exports from systems with European regional settings use semicolons because the comma is the decimal separator there. Auto-detect handles it; if a file fools the sniffing, pick the delimiter manually.

Is the generated SQL safe to run?

The generator escapes single quotes by doubling them (O'Brien'O''Brien'), which is the standard-conformant way to embed them in string literals, and offers identifier quoting for names that need it. Review generated SQL before running it against anything that matters, as you would any import script — especially the column types.

Why not XLSX support?

An .xlsx workbook is a ZIP archive of XML with styles, formulas, and multiple sheets — a much larger format than CSV, and supporting a sliver of it badly would be worse than not supporting it. Export the sheet as CSV and everything on this page applies.