Skip to the JSON editor
JSON Formatter Viewer

CSV to JSON

input.csv

output.json

The JSON appears here.

or drop a .csv file into the left pane

Waiting for input

How the parse works

The first row is treated as the header, and each subsequent row becomes an object keyed by those column names. Parsing is a character-by-character scan that tracks whether it is inside a quoted field, which is what makes embedded delimiters and line breaks safe:

id,note
1,"Hello, world"
2,"line one
line two"

Row 1's note keeps its comma, and row 2's keeps its newline. A naivesplit(',') gets both wrong, which is the single most common reason a hand-rolled CSV import corrupts data.

Type inference

CSV has no types — every field is text. Values are converted only when they match canonical JSON syntax exactly:

  • 42, -1.5, 2e10 become numbers.
  • true and false become booleans, null becomes null.
  • Everything else stays a string — including 007, 1,5,+44 20, and 0x1F.

That conservative rule is deliberate. Aggressive coercion is how zip codes lose their leading zeros and how product codes turn into scientific notation.

Delimiters and encoding

A leading UTF-8 byte order mark is stripped, so files exported from Excel do not end up with a stray character glued to the first column name. Line endings may be LF,CRLF, or bare CR.

After converting

Send the result to the tree viewer to inspect it, or theformatter to change the indentation. To go the other way, useJSON to CSV.

Common questions

Does it handle semicolons or tabs instead of commas?

Yes. The delimiter is detected from the first line by trying comma, semicolon, tab, and pipe and keeping whichever splits it into the most fields. European exports that use semicolons and TSV files both work without any setting.

Why is my phone number or zip code still a string?

Only canonical JSON number syntax is converted. 007, +1-555-0100, and 1,5 stay strings, because turning them into numbers would silently destroy the leading zero or the formatting. 42 and -1.5e3 do become numbers.

What if two columns have the same header?

Object keys are unique, so a duplicate would silently drop a column. The second occurrence is suffixed instead — name and name_2 — and a blank header becomes column_3 for the third column. Every column stays addressable.

Can a value contain a line break?

Yes, as long as it is inside double quotes. The parser tracks quote state character by character, so a quoted field spanning several lines is read as one value rather than breaking the row.

The rest of the toolkit

Same engine, same privacy — every page runs entirely in your browser.