CSV ↔ JSON converter
Turn CSV into an array of objects and back, with delimiter and header control.
What this does
CSV → JSON reads delimited text and produces either an array of objects (when the first row is a header) or an array of arrays (when it isn't). JSON → CSV takes an array and writes one row per element, with a header row derived from the union of all object keys. Parsing and serialization are handled by PapaParse, which implements RFC 4180 quoting rules and handles quoted newlines, escaped quotes, and ragged rows.
Everything runs in your browser, so a customer export, a finance report, or a user list can be reshaped here without uploading it anywhere.
When you'd use it
- Turning a spreadsheet export into JSON to seed a database or a test fixture.
- Converting an API's JSON array into CSV to open in a spreadsheet or hand to a non-technical colleague.
- Inspecting exactly how a CSV parses — where the column breaks land, what types are inferred — before writing code against it.
- Changing the delimiter of a file (for example semicolon-separated European CSV to comma-separated).
Worked example
Input CSV, with "First row is header" and "Infer numbers & booleans" both on:
sku,name,price,in_stock A-100,Widget,9.99,true A-101,Gadget,14.5,false
Output JSON:
[
{ "sku": "A-100", "name": "Widget", "price": 9.99, "in_stock": true },
{ "sku": "A-101", "name": "Gadget", "price": 14.5, "in_stock": false }
]
Note that sku stays a string because it isn't numeric, while
price becomes a number and in_stock becomes a
boolean. Convert that JSON back with direction JSON → CSV and you get the
original file, with a
after each row.
Limits and gotchas
- Type inference is heuristic. It's convenient but lossy — turn it off whenever the exact text of a field matters.
- Nested data doesn't survive JSON → CSV. Flatten objects and arrays into scalar columns first.
- Inconsistent columns. If some rows have more fields than the header, the extras land under numeric keys; if fewer, missing keys are empty strings.
- Big files. Parsing is done in one pass in memory. Multi-hundred-megabyte files may exhaust the tab's memory.
- Excel quirks. A leading
=in a cell is data here, not a formula; a UTF-8 BOM at the start of the file is stripped on parse.
Frequently asked questions
- Why are my leading zeros gone (007 became 7)?
- That happens when "Infer numbers & booleans" is on:
007is read as the number 7. Zip codes, product codes, and phone numbers should stay text — turn that option off, or the value will lose its formatting. With inference off, every field is kept as a string. - My file has commas inside quoted fields and the columns are misaligned.
- A properly quoted CSV (
"Smith, John",42) parses correctly here. Misalignment usually means the quoting is inconsistent — an unescaped quote inside a field, or a mix of quoted and unquoted rows. The error message names the row number; check that row for a stray". - JSON → CSV produced [object Object] in a cell.
- CSV is flat: one value per cell. If a record contains a nested object or array, there is no correct way to put it in a single cell, so it is stringified. Flatten nested fields first (for example
address.cityas its own column) before converting. - Which line endings and encoding does the output use?
- Output CSV uses
\r\nline endings, which is what the CSV specification (RFC 4180) and Excel expect. Text is UTF-8. If a downstream tool needs\nonly, convert the line endings after copying.