CSV to JSON.
Paste a CSV, get a pretty-printed JSON array of objects. Handles quoted fields, escaped quotes, newlines inside cells, and custom delimiters. Auto-parses numbers and booleans so the output is immediately usable.
· converts in your browser · nothing uploads · localStorage persists your last input
When CSV → JSON is the right move
- Seed data for tests. You have a spreadsheet of sample users, products, or fixtures. CSV → JSON gives you a ready-to-paste array.
- API mocking. Mock an API response without standing up a mock server — stash the JSON in a static file and fetch it.
- Data migration. Moving records between systems? CSV → JSON → POST to the new API is a common shape.
- Exploring data in code. JavaScript and Python both handle JSON natively; CSV takes a parser.
CSV parsing gotchas
- Commas inside fields. A cell like "Smith, John" must be quoted. If you see fields splitting in weird places, the source CSV probably isn't quoting properly.
- Quotes inside fields. Inside a quoted field, a literal quote is escaped by doubling it:
"He said ""hi"""decodes toHe said "hi". - Newlines inside fields. Legal if the field is quoted. The parser handles it; the row count still reflects real rows, not text lines.
- Leading zeros. Turn off "parse numbers" if your data has ZIP codes like "01234" or version strings like "1.2.3". Auto-parsing will eat the leading zeros or turn version strings into malformed floats.
- Excel BOM. Files exported from Excel often start with a three-byte UTF-8 BOM. The parser strips it automatically, but know it's there if you're debugging odd first-column key names.
FAQ
How do I convert a CSV to JSON?
Paste your CSV into the input panel. The JSON output appears on the right, one object per row with the header row as keys. If your first row is data, not headers, uncheck 'header row' and you'll get columns named col_1, col_2, etc. instead. Click Copy or Download when you're done.
What CSV features does the parser handle?
All the usual ones: quoted fields (for cells containing the delimiter), escaped quotes (two consecutive quotes inside a quoted field represents one literal quote), newlines inside quoted fields (preserved correctly), and custom delimiters. Leading UTF-8 BOMs are stripped automatically.
Should I auto-parse numbers and booleans?
Usually yes — it gives you JSON you can use immediately in code. A row like '42,true,hello' becomes [42, true, 'hello'] in JSON. Turn off auto-parsing if your columns contain things that LOOK numeric but aren't (phone numbers, ZIP codes with leading zeros, version strings like '1.2.3') and you want them preserved as strings.
What if my CSV delimiter isn't a comma?
Set it in the delimiter dropdown. Common alternatives: tab (TSV files, especially from scientific data), semicolon (European locales where comma is the decimal separator), pipe (when the data contains commas as text). The parser is strictly delimiter-based — it doesn't try to guess.
Does this work for large CSV files?
For files up to ~100MB, yes — modern browsers handle that comfortably in memory. For truly large files (GB-scale or millions of rows), a streaming parser on the command line is the right tool. Try `csvkit`'s `csvjson` command for CSV → JSON, or write a 10-line script with Node's fast-csv or Python's csv module.
Can it flatten rows into nested JSON?
Not directly — it produces a flat array of objects, matching the CSV's flat structure. If your column headers use dot notation (like 'user.name') and you want the output to be nested, the simplest next step is to paste the flat JSON into a separate un-flatten script. For simple cases a regex find-and-replace is enough.
What happens to blank rows or trailing commas?
Trailing empty rows (at the end of the file) are dropped. Trailing delimiters on a line produce empty-string fields in the output object (the key still exists). A row with fewer fields than the header row gets the missing fields as empty strings (or missing from the object, depending on how you read it).
Is my CSV uploaded anywhere?
No. Parsing happens entirely in your browser using native JavaScript. No network request, no log, no analytics event includes your data. The input and settings are persisted in localStorage for convenience — that data stays in your browser.
Related
- · JSON to CSV — reverse direction, with nested-object flattening.
- · JSON to Excel — same tool, Excel-forced defaults.
- · How to create a CSV file — full rundown of CSV creation methods.