CSV ⇄ JSON Converter

Paste or drop a file and convert between CSV and JSON in both directions, with a proper RFC 4180 parser that handles quotes, commas inside values and multi-line fields.

🔒 Your data never leaves your device🆓 Free🙅 No sign-up

Or just paste below. Files are read in your browser and never uploaded.

Paste rows, or drop a file above. Quoted fields, embedded commas and newlines are all handled.

⚙️ Options

Set to 0 for a single compact line.

Paste or drop something above and the converted result will appear here.
🔒 Everything runs in this tab. Your data is parsed by JavaScript on your own device and is never uploaded, logged or stored.

How to use the converter

  1. Choose a direction: CSV → JSON or JSON → CSV.
  2. Paste your data into the input box, or drop a .csv, .tsv, .txt or .json file onto the drop zone. Dropping a CSV file also auto-detects its delimiter.
  3. Set the options — delimiter, whether the first row is a header, type detection, nested-object handling, and the line ending for CSV output.
  4. Check the preview table, which shows the first 20 rows along with the row and column counts, so you can confirm the parse looks right before you trust it.
  5. Copy the result or download it as a .json or .csv file.

If something is wrong with the input, the error message names the line — and where possible the column — so you can find it instantly instead of scanning the whole file.

How the CSV parsing works

CSV looks trivial and is not. A file is a sequence of records, each a sequence of fields, and quoting rules make the difference between correct and almost correct:

Rule Example input Parsed value
Plain field Oslo Oslo
Delimiter inside quotes "Doe, Jane" Doe, Jane
Escaped quote "She said ""hi""" She said “hi”
Newline inside quotes "line1⏎line2" line1, newline, line2
Empty field a,,c a, empty string, c

The parser walks the text one character at a time and tracks whether it is inside a quoted field. That is what allows a comma or a line break to sit harmlessly inside a value. It also accepts all three line endings — LF, CRLF and a lone CR — normalises them, strips a UTF-8 byte order mark if a spreadsheet left one at the start, and refuses to silently swallow an unterminated quote.

Writing CSV applies the same rules in reverse. A field is quoted only when it needs to be: when it contains the delimiter, a double quote, a line break, or leading or trailing spaces. Everything else is written bare, which keeps the output small and readable. You can override that with Quote every field if the consumer on the other end is picky.

Delimiters. The dropdown offers comma, semicolon, tab and the pipe character. Semicolon files are common wherever the comma is the decimal separator, because 1,5 would otherwise split a column in two.

Type inference. With detection on, 42 becomes a JSON number, true and false become booleans, and null becomes null. Values that would not survive the round trip are deliberately left alone: 007, +1, 1,5 and anything padded with spaces all stay strings.

Dot paths. Nested JSON is flattened into dotted column names on the way out, and dotted headers can be expanded back into nested objects on the way in. Arrays are never split across columns — they are written into a single cell as JSON, so nothing is lost.

Worked examples

A quoted name with a comma. The input

name,city
"Doe, Jane",Oslo

produces [{ "name": "Doe, Jane", "city": "Oslo" }]. Splitting on commas would have given three fields and a wrong answer.

Missing keys across records. Converting [{"a":1},{"b":2}] to CSV collects the union of keys in first-seen order and leaves the gaps blank:

a,b
1,
,2

Nested objects. [{"user":{"name":"Ada"},"ok":true}] becomes the columns user.name and ok, with the row Ada,true. Turn flattening off and the same record produces one column called user whose cell holds {"name":"Ada"} as an escaped JSON string.

A round trip. Take note with the value spanning two lines. Converting to JSON gives a single string containing a newline character; converting back re-quotes it, so the file you started with and the file you end with are equivalent.

Common mistakes

  • Splitting on commas in code. Every language has a CSV library. A regular expression will work on your sample and fail on real data the first time someone types a comma into an address field.
  • Assuming a header row. If the first line is data, turn the header option off — otherwise your first record disappears into the column names.
  • Letting type detection mangle identifiers. Order numbers, postcodes and account references often look numeric but must stay strings. Switch detection off for reference data.
  • Ignoring the line ending. Some older Windows tools require CRLF. Most modern tooling is happy with LF. If an import fails for no visible reason, try the other one.
  • Mixing delimiters in one file. A file that is semicolon separated but has a comma-separated header will parse with the wrong column count. The preview’s column counter catches this immediately.
  • Forgetting duplicate headers. Two columns called name cannot both be a key in the same object. The second is renamed name_2 so no data is silently dropped.

Privacy

This converter is entirely client side. The text you paste, and any file you drop, is read with the browser’s File API and parsed by JavaScript running on your own device. Nothing is sent to a server, nothing is logged, and no copy is kept: reloading or closing the tab discards everything. Your option choices — delimiter, header, indent and so on — are remembered in this browser’s localStorage so the tool behaves the same on your next visit, but your data never is. That also means the page keeps working offline once it has loaded, which makes it safe to use on exports you would not want to paste into an online service.

Frequently asked questions

What is RFC 4180 and why does it matter?

It is the specification that defines the common CSV dialect — how fields are separated, when they must be quoted, and how a literal double quote is escaped by doubling it. Splitting a line on commas ignores all of that and breaks the moment a value contains a comma or a line break, which is why this tool uses a real character-by-character parser instead.

How are nested JSON objects turned into CSV columns?

They are flattened into dotted column names, so an object like a user with a name becomes the column `user.name`. Turning the flatten option off writes the whole object into one cell as a JSON string instead. Going the other way, the expand option rebuilds nested objects from dotted headers.

What happens to missing keys?

They become empty cells. The converter collects the union of every key across all records, in the order each key first appears, so a record that lacks a field simply gets a blank in that column rather than shifting the row.

Why is my postcode 01234 not converted to a number?

On purpose. Type inference only converts values that survive a round trip, so anything with a leading zero, a plus sign or surrounding spaces stays a string. Otherwise identifiers, postcodes and phone numbers would silently lose digits.

Can it handle a semicolon or tab separated file?

Yes. Pick the delimiter from the dropdown — comma, semicolon, tab or pipe — or press Detect delimiter and the tool counts the candidates in the header line for you. Exports from European spreadsheets are usually semicolon separated.

How large a file can I convert?

Files up to about 8 MB are comfortable. Everything is parsed in this browser tab, so much larger files can make the page unresponsive while it works. Split a very large export into chunks first.

Related tools

Last reviewed: