LocalToolkit
HomeData Converters › CSV to JSON Converter

CSV to JSON Converter

A parser that honours RFC 4180 quoting, so quoted commas and embedded newlines survive.

🔒 Runs in your browser. Nothing is uploaded — verify it in the network panel, or disconnect and try again.

Why hand-written CSV parsers fail

Splitting on commas works until the first field contains one. A real parser is a small state machine that tracks whether it is inside a quoted field, because inside quotes a comma is data, a newline does not end the record, and "" means one literal double quote. The test case that catches nearly every naive implementation is a field holding an address: "123 Main St, Apt 4" must produce one cell, not two.

With and without a header row

Type inference: helpful and dangerous in equal measure

CSV carries no types, so a converter must guess. This tool converts a cell to a number when it looks strictly numeric, and leaves it as a string otherwise. Three cases are deliberately conservative because guessing wrong is worse than not guessing:

Cell textResultWhy
42number 42Unambiguous
007string "007"Leading zeros mean it is an identifier, not a number
1e3string "1e3"Ambiguous — treated as text to avoid surprises
trueboolean trueJSON has a native boolean
2026-01-15string "2026-01-15"JSON has no date type; keep it as text
`` (empty)empty stringnull and "" cannot be distinguished in CSV

Delimiters, encodings and the BOM

Although the format is named after the comma, semicolon-separated files are standard in locales where the comma is the decimal separator, and TSV remains common because tab almost never appears inside a field. Files exported from Excel on Windows frequently begin with a UTF-8 byte-order mark; a parser that does not strip it produces a first key literally named \uFEFFname, which then fails to match anything downstream.

Very large files

A converter that builds one giant array in memory is bounded by tab memory. If you are working with a multi-hundred-megabyte export, convert in chunks and emit JSON Lines — one object per line — which streams and lets you process records one at a time without ever holding the whole dataset.

How to use it

  1. Paste the CSV or drop a file.
  2. Set the delimiter — comma, tab, semicolon, pipe or space.
  3. State whether the first row is a header.
  4. Convert and inspect the first few records.

Worth knowing

  • RFC 4180 quoting lets a field contain commas, quotes and newlines.
  • Inside a quoted field, "" represents one literal double quote.
  • Leading zeros are preserved as strings to protect identifiers and postal codes.
  • Excel on Windows often writes a UTF-8 BOM that must be stripped.

Limitations

  • Type inference is heuristic — always validate the output against your schema.
  • null cannot be expressed in CSV and becomes an empty string.
  • Nested structure cannot be recovered; a cell holds a flat string.
  • Multi-gigabyte files are better processed in chunks than in a browser tab.

Frequently asked questions

How do I handle commas inside quoted fields?
The parser tracks quote state, so a comma inside a quoted field is data. You do not need to do anything — that is what RFC 4180 quoting is for.
What happens to my header row?
With header mode on it becomes the JSON keys and is not emitted as data. Turn it off for headerless files, or the first row of data will be consumed as column names.
Why is a number coming out as a string?
Because the cell had a leading zero, was quoted in the source, or used a notation treated as ambiguous. Identifiers like 007 and postal codes must stay strings or they lose information.
Can I convert CSV to JSON Lines instead of an array?
Yes — emit one object per line. It is the right shape for streaming, for log ingestion, and for any file too large to hold as a single array.
Related tools
JSON to CSV ConverterJSON Formatter & ValidatorYAML to JSON ConverterXML to JSON ConverterJSON MinifierJSON to YAML Converter
Keep reading
How browser-only processing worksAll Data Converters toolsEvery tool on the site