GitGudgit gud
gitgudRun an audit
‹ all tools
Convertgitgud / tools

CSV ⇄ JSON Converter

CSV to JSON and back, with delimiter detection, header handling and type coercion.

Runs entirely in your browser — nothing you paste is uploaded.

About CSV ⇄ JSON Converter

CSV is the format everything exports and nothing agrees on. This converts it to a JSON array of objects and back, handling the parts that break naive splitting: fields containing the delimiter, fields containing quotes, fields containing newlines, and the UTF-8 byte-order mark that Excel puts at the front of every file it writes.

The delimiter is detected rather than assumed — comma, semicolon, tab and pipe all appear in the wild, and European locales export semicolon-delimited files as a matter of course. You can override the detection when a file has a single row and nothing to detect from.

Type coercion is a toggle, off by default, because it is genuinely ambiguous. With it on, `42` becomes a number and `true` becomes a boolean. With it off, everything stays a string — which is what you want for zip codes, phone numbers, product SKUs and anything else with a leading zero that a coercing parser will quietly destroy.

Going the other way, JSON to CSV, nested objects are flattened with dotted keys — `{"user":{"id":1}}` becomes a `user.id` column — because CSV has no concept of nesting and the alternative is dropping the data. The union of all keys across all rows becomes the header, so rows with missing fields produce empty cells instead of misaligned columns.

Frequently asked

How do I keep leading zeros on zip codes?

Leave type coercion off. With coercion on, `01234` parses as the number 1234 and the zero is gone. This is the single most common way CSV imports corrupt data, and it's why coercion defaults to off here.

How are commas inside a field handled?

Correctly — a field containing the delimiter must be quoted, and a quote inside a quoted field is escaped by doubling it. The parser follows RFC 4180 on both, which is why it handles `"Smith, John"` and `"She said ""hi"""` without splitting them.

What is the BOM at the start of my file?

A UTF-8 byte-order mark, which Excel writes so it recognises the encoding on reopen. It shows up as a stray `` prefix on your first column name in parsers that don't strip it. This one does.

Can it handle newlines inside a cell?

Yes, as long as the field is quoted — which is required by the spec for any field containing a newline. An unquoted newline genuinely is a row separator and there's no way to tell otherwise.

What happens to nested JSON when converting to CSV?

It's flattened with dotted key paths. Arrays of objects are the awkward case: they get JSON-serialised into a single cell rather than expanded, because expanding them would change the row count.

Related tools