Account

What new tool do you want?

Developer Tools

CSV to JSON Converter

Convert CSV or spreadsheet data to a JSON array of objects, with header detection, number/boolean typing and any delimiter.

How to use

  1. 1Paste CSV (or cells copied from a spreadsheet).
  2. 2The first row becomes the keys; choose whether to convert numbers and booleans.

Frequently asked questions

Does it handle commas inside values?

Yes. Values in double quotes can contain commas, quotes (written as "") and even line breaks, following RFC 4180.

What if my file has no header row?

Turn off 'First row is header' to get an array of arrays instead of objects.

Which delimiters are supported?

Comma, tab, semicolon and pipe — detected automatically from the first line.

RFC 4180 quoting is where naive CSV parsers break

A surprising number of 'CSV to JSON' scripts are just `line.split(',')`, which breaks the moment a value contains a comma, an embedded line break, or a quote that needs escaping. This tool's parseCsv follows RFC 4180 properly: a value in double quotes can contain commas and newlines, and an embedded double quote is written as two consecutive quotes (`""`) — so `"Doe, J"` correctly becomes the single value `Doe, J` rather than splitting into two columns. If your source data was exported from Excel or Google Sheets, it almost certainly relies on this quoting, which is exactly the case the included example demonstrates.

Type inference is opt-in, and it's all-or-nothing per cell

With 'Convert numbers & booleans' on, each cell is independently run through type inference, so a column can end up with mixed types if the source data is inconsistent (e.g. a mostly-numeric ID column with one blank row). Turn it off when you specifically need every value to stay a string — the common case being IDs or codes that look numeric but should never be treated as a number (a ZIP code '00501', a leading-zero account number), where silent numeric conversion would corrupt the value.

No header row means a different output shape, not an error

Unchecking 'First row is header' doesn't fail or guess a header for you — it switches the output to an array of arrays, with each row becoming a plain JSON array of cell values in order. That's the right shape for truly headerless exports (some legacy systems, some direct database dumps), but it means downstream code needs to access fields by index rather than by name, which is worth deciding on before you wire up a consumer for the JSON.

Worked example: CSV to JSON Converter

Paste `name,age,ok\n"Doe, J",31,true` with the defaults on, and you get a single-object array: `[{ "name": "Doe, J", "age": 31, "ok": true }]` — note the quoted comma inside 'Doe, J' didn't split into two columns, and `31`/`true` became a real number and boolean rather than strings. Turn off 'Convert numbers & booleans' on a semicolon-delimited `a;b\n1;x` and you instead get `[{ "a": "1", "b": "x" }]`, with `1` staying a string.

The separator is guessed from the first line, and 01 stays text

The separator is chosen from the first line only. Comma, tab, semicolon, and pipe are counted, and the one that appears most often wins. If the first line has none of them, a comma is used. A quote that opens and never closes stops with a message about an unclosed quote, and I get no rows. A completely blank line is dropped. First row is header starts on, and an empty box becomes an empty list. Convert numbers and booleans starts on. An empty cell becomes null in that mode. true and false must be lowercase. A number with a leading zero, such as 01, stays text so it is not turned into 1. A short row is filled with an empty cell.

Related tools

More: Developer Tools