CSV to JSON
Convert CSV data into structured JSON.
How to use CSV to JSON
What this tool does
This tool converts CSV — comma-separated values — into JSON. You paste CSV text
or drop a .csv file, and it returns a clean, pretty-printed JSON document. With
headers enabled you get an array of objects, where each column name becomes a
key; with headers disabled you get an array of arrays. The parser is a proper
RFC 4180 implementation, so quoted fields, embedded commas, and multi-line cells
all survive intact. Every step runs in your browser, so the data never leaves
your machine.
Why you might need it
CSV is everywhere — it is what spreadsheets export, what analytics dashboards download, and what legacy systems produce. But almost every modern API, config file, and JavaScript program speaks JSON. Converting between the two by hand is deceptively hard: a naive “split on commas” approach breaks the moment a cell contains a comma, a quote, or a line break. This tool handles those cases correctly, so you can move tabular data into a JSON-based workflow without writing a parser yourself.
How to use it
- Paste your CSV into the input box, or drop a
.csvfile onto it. - Pick a delimiter, or leave it on Auto-detect to let the tool guess.
- Toggle First row is headers depending on whether row one names the columns.
- Optionally enable Trim whitespace and Infer numbers & booleans.
- Click Convert to JSON, or press Ctrl/Cmd + Enter, then copy or download the result.
How the parser works
Rather than splitting on the delimiter, the converter scans the CSV one
character at a time and tracks whether it is currently inside a quoted field.
Inside quotes, commas and newlines are treated as ordinary text, and a pair of
double quotes ("") collapses into one literal quote. Outside quotes, the
delimiter ends a field and a newline ends a row. Both \r\n and a lone \n
are accepted as line endings. This is what lets a cell like
"Said: ""compilers"" first" or a value spanning two physical lines round-trip
correctly into a single JSON string.
Common pitfalls
Type inference is convenient but occasionally surprising. A value such as 007
or a phone number with a leading zero will be turned into the number 7 if
inference is on — turn it off to keep those as strings. Likewise, very large
integers can lose precision once parsed as JSON numbers. Another thing to watch:
if your header row has a blank cell, that column is given a generated name like
column3 so the JSON keys stay valid. Finally, if auto-detection picks the
wrong delimiter — common when a comma-separated file has many semicolons in its
text — set the delimiter manually.
Tips and advanced use
For tab-separated files (TSV), simply choose Tab as the delimiter; the same parser handles them. If you plan to feed the JSON into code that expects exact string values — postal codes, account numbers, SKUs — leave inference off so nothing is silently coerced. When a CSV has trailing spaces around values that you do not want, the Trim whitespace option cleans every cell. And because the entire conversion is client-side, you can safely process exports containing emails, names, or internal identifiers without any of it being uploaded.