JSON to CSV Converter
Convert JSON arrays back to CSV spreadsheets instantly.
Convert CSV to JSON online in seconds. Paste CSV data and get a JSON array of objects instantly: the first row becomes the keys, and every following row becomes an object. Quoted fields and custom delimiters are handled correctly, and everything runs 100% client-side, so your data never leaves your browser.
Converting CSV to JSON is mostly a mapping exercise. The first line of the file is read as a list of column names, and every following line becomes one object whose keys are those names and whose values are the fields in matching positions. An array of those objects is the output.
This is why the header row carries so much weight. It is the schema of the file, and any oddity in it propagates into every single record. Column names with spaces, trailing whitespace, or mixed casing all become awkward object keys, so it is worth trimming and normalising them before the conversion rather than fixing thousands of objects afterwards.
If the header uses dot notation, unflattening can rebuild nested structure: a column called address.city puts city inside an address object instead of creating a literal key with a full stop in it. That is what makes a JSON to CSV to JSON round trip come back to where it started.
A small inventory export, converted with type inference and unflattening turned on.
CSV input
JSON output
Two details are worth noticing. The quoted title in row two keeps its comma and loses its quotes, because the quotes were transport syntax rather than content. And 24.50 became 24.5, because JSON numbers have no concept of trailing decimal places.
Every value in a CSV file is text. Type inference is the step that decides which of those text values should become JSON numbers, booleans, or null.
| Cell content | Inferred as | Risk |
|---|---|---|
| 42 | Number | Low, unless it is a zero padded code |
| 3.14 | Number | Low |
| 007 | String if padding is preserved | High, inference may strip to 7 |
| true / false | Boolean | Low, but TRUE and yes need explicit rules |
| (empty) | null or empty string | Ambiguous, an empty string and a missing value are not the same thing |
| 1e5 | Number 100000 | Product codes and batch ids get mangled |
| +441234 | String or number | Leading plus is dropped by many parsers |
There is a real argument for leaving everything as strings. Identifiers, phone numbers, postcodes, account numbers, and version strings are all data that looks numeric but must never be arithmetic. If the JSON is going straight into a system that will validate and cast it anyway, strings in and strings out is the safest default. Turn inference on when the JSON is being consumed directly by application code that expects real numbers.
A correct CSV parser is a small state machine, not a call to split. It has to track whether it is currently inside a quoted field, because inside quotes the delimiter and the line break are ordinary characters.
One record spanning three physical lines
That file has four physical lines but only two records. A doubled quote inside a quoted field means a literal quote character, so "He said ""no""" holds the value He said "no". Anything that splits on the newline before understanding quotes will produce three broken rows and no error message.
| Edge case | What goes wrong | Sensible handling |
|---|---|---|
| Duplicate header names | The later column silently overwrites the earlier one | Suffix duplicates as name, name_2, name_3 |
| Empty header cell | Produces an object key of empty string | Fall back to column_1, column_2 by position |
| Ragged row, too few fields | Missing keys, uneven objects | Pad with null so every object has the same shape |
| Ragged row, too many fields | Extra values have no key | Collect the surplus into an _extra array or reject the row |
| Blank line in the middle | Emits an object of all nulls | Skip empty lines by default |
| Comment lines starting with # | Parsed as data | Enable a comment prefix option before parsing |
| CRLF versus LF endings | Trailing carriage return glued onto the last field | Normalise line endings before splitting |
This one deserves its own section because it wastes more time than anything else on the list. Files exported from Excel on Windows often begin with a UTF-8 byte order mark, three invisible bytes (EF BB BF) before the first character. Most editors hide it. Your parser does not.
What you see and what you get
The symptom is unmistakable once you know it: only the very first column comes back undefined and every other column is fine. The fix is to strip a leading U+FEFF from the file before parsing, or to decode the file with an encoding that consumes the mark. If you are producing files for Excel rather than consuming them, the reverse applies, since Excel needs that mark to recognise UTF-8 at all.
Once your CSV is clean JSON, the next step is usually a schema or a type. Browse the full converter collection for JSON to TypeScript to generate interfaces from the result, JSON Schema for validation rules, and JSON to CSV when you need to send the data back the other way.
CSV is the universal export format for spreadsheets, databases, and analytics tools, but modern APIs and JavaScript applications speak JSON. This CSV to JSON converter bridges that gap: paste a CSV export from Excel, Google Sheets, or any database dump, and get a clean JSON array of objects ready for your code. The parser follows standard CSV quoting rules, so commas and line breaks inside quoted fields are preserved, and custom delimiters (semicolon, tab, pipe) cover regional Excel exports and TSV files. Because the converter is free and runs entirely in your browser, it is a safe choice for customer lists, financial exports, and any data you would rather not upload to a server.