CSV to JSON
CSV to JSON Converter
Convert CSV to JSON entirely in the browser. Paste or drop a file on the left, receive JSON on the right. Output can be a standard JSON array or JSON Lines (NDJSON) — the latter is preferable for streaming pipelines and very large datasets. RFC 4180 quoting is supported, and no file is uploaded at any point, which also sidesteps the 10 MB caps common to hosted converters.
Before you start
You need one of the following:
- A CSV file on your computer (
.csv,.tsv, or plain.txt— any delimiter is auto-detected), or - CSV text you can paste directly into the input pane.
The first row is treated as the header row and its values become the keys in the
output JSON. If your file has no header, add one before pasting, or you'll end up with keys
like "42", "Alice" taken from the first data row.
There is no file size cap, but your browser's memory is. As a rough rule of thumb, files under 200 MB convert without drama on a modern laptop; above that, consider the JSON Lines option so nothing has to fit into a single string.
How to use it
- Paste your CSV into the left pane, or drop a
.csvfile anywhere on the pane. - Pick a Format: JSON array for a single document, or JSON Lines for one object per line.
- Toggle pretty-print if you want indentation (handy for reading, terrible for file size).
- Review the output on the right — the status bar at the bottom tells you how many rows were parsed.
- Click Copy to put the result on your clipboard, or Download .json to save a file.
Options explained
JSON array vs. JSON Lines
JSON array gives you a single valid JSON document: [{...}, {...}].
Use this when the consumer expects one blob — e.g. pasting into a REST client, feeding a
frontend that does JSON.parse(), or storing a small reference file.
JSON Lines (also called NDJSON) is one JSON object per line, with no outer brackets and no commas between records. Use this for big files, log pipelines, BigQuery / Snowflake / S3 imports, and anything that streams record-by-record. It's also much faster to append to.
Pretty-print
Off produces a single compact line per record. On adds two-space indentation for arrays and readable newlines inside each object. For JSON Lines, pretty-print is ignored: the format requires one record per line.
Example
Input:
id,name,active
1,Alice,true
2,"Bob, Jr.",false
Output (JSON array, pretty-printed):
[
{ "id": "1", "name": "Alice", "active": "true" },
{ "id": "2", "name": "Bob, Jr.", "active": "false" }
]
Notice that id and active come out as strings, not
numbers or booleans. That's deliberate — see the FAQ below.
Tips & common pitfalls
- Values are strings, by design. A cell like
007stays"007". If this tool auto-converted, you'd lose leading zeros, scientific-notation IDs, and "false" vs. the literal word. Cast to numbers/booleans downstream where you control the logic. - UTF-8 BOM is handled. Excel likes to prepend
to exported CSVs; the parser strips it so the first key isn't"id". - Delimiter auto-detection samples the first few lines. If your file is mostly numeric and the first few lines have the "wrong" structure, the parser may pick semicolons by mistake — add a clearer header row if you see odd output.
- Embedded commas and newlines are fine if the cell is double-quoted, per RFC 4180.
"Bob, Jr."parses as one cell. - Duplicate header names will overwrite each other in the JSON object. Rename duplicates in the source before converting.
Troubleshooting
The output only has one giant row, or all cells are in one column.
Your delimiter was misdetected. Make sure the first 10–20 lines of the file actually contain delimiters; weirdly-shaped preambles break the detector. Strip any non-CSV preamble and try again.
Numbers lost leading zeros / got converted to scientific notation.
That happens in Excel, not here — this tool keeps everything as strings precisely to avoid that. Re-export from Excel with "Text" format for the affected columns.
The browser tab freezes on a huge file.
Switch the Format to JSON Lines and turn off pretty-print. That keeps the output as a stream of lines instead of one giant string, which is easier on memory.
Frequently asked questions
Does this handle CSVs with embedded commas?
Yes. RFC 4180-style quoting is the default: any cell wrapped in double quotes can contain commas, newlines, and (doubled) double quotes.
What about semicolon or tab delimiters?
The parser auto-detects the delimiter by sampling the input. Comma, semicolon, tab, and pipe all work without configuration.
Why are all values strings in the output? I want real numbers.
Because CSV is a text format with no type information, and auto-typing causes real bugs: IDs lose leading zeros, postal codes become numbers, "NaN" becomes NaN. Cast to the correct type in the language that consumes the JSON, where you know the schema.
Does my file get uploaded anywhere?
No. Parsing runs in your browser using JavaScript; the only network traffic this page generates is loading the page itself and the PapaParse library. See the privacy policy.
Is there a command-line version?
Not from me, but you can get the same behaviour with mlr --icsv --ojsonl cat file.csv (Miller) or csvjson file.csv (csvkit). Handy for scripting.