CSV to JSON Converter
Turn comma-separated data into a JSON array of objects. The delimiter is detected automatically — comma, semicolon, tab or pipe — and quoted fields that contain embedded commas, quotes or line breaks are parsed correctly instead of being split at the wrong column.
CSV input
JSON output
Ready — paste some input or load the sample.
100% Client-Side · Privacy First. This tool runs entirely inside your browser. Nothing you type is uploaded, logged or sent to a server — you can even use it offline.
Overview
CSV is a format with many dialects and few rules, which is why converting it is harder than it looks. The first row is usually a header, but not always. Fields may be separated by commas, semicolons, tabs or pipes, and the right choice is often the one that does not appear inside the data. Values may be wrapped in quotes, may contain the delimiter itself, may contain newlines, and may use doubled quotes to represent a literal quote. A leading byte order mark is a common invisible defect that ends up inside the first header name. This converter handles those cases: it detects the delimiter, strips the byte order mark, honours quoted fields with embedded separators and line breaks, and can treat the first row as data when a file has no header at all. Duplicate header names, which silently overwrite each other in most naive converters, are suffixed so that both columns survive. The output is formatted JSON that you can paste into an API call, a fixture file or a code editor.
How to use the csv to json converter
- 1Copy the CSV content from your spreadsheet or file and paste it into the input panel.
- 2Check the detected delimiter and the header row setting in the notes panel, and correct them if the guess was wrong.
- 3Review the notes for duplicate header names or ragged rows, which are the two things that usually surprise you in exported data.
- 4Read the JSON array in the output panel and copy it, or download it as a .json file.
- 5If your source file starts with a byte order mark, the first header name is cleaned automatically so it does not arrive with an invisible prefix.
- 6Check the notes for the number of rows that were converted, which tells you at a glance whether the whole file arrived.
Cheat sheet
The syntax you will use most, and what each part does.
| Pattern | What it means |
|---|---|
"a,b",c |
A quoted field may contain the delimiter, and it is returned as one value: a,b. |
"He said ""hi""" |
A doubled quote inside a quoted field stands for one literal quote character. |
a,b
c,d |
Windows line endings are handled, and a quoted field may even span several lines. |
BOM before the first name |
The byte order mark is stripped so your first key is "id" and not a key with three invisible characters in it. |
id,name
1,a
2 |
A short row is padded with empty strings, so every object keeps the same set of keys. |
Duplicate header names |
The later column gets a _2 suffix, so no value silently overwrites another. |
Common mistakes
The first key has strange characters.
The file starts with a byte order mark. It is removed automatically, and if it survives, the first column name is the one with the invisible prefix.
Rows have the wrong number of values.
Some rows are longer or shorter than the header. Missing cells become empty strings and extra cells are dropped rather than shifting the later columns.
A column is missing from the output.
Two columns share the same name. The later duplicate gets a numeric suffix, so both columns survive in the JSON.
The delimiter was guessed wrong.
Semicolon-separated files exported from a European spreadsheet are the usual culprit. Switch the delimiter manually and convert again.
Worked examples
A simple table with a header
id,name 1,Ada 2,Grace
An array of two objects with the keys id and name, ready for JSON.stringify or an API body.
Quoted values with separators inside
name,note "Smith, John","said ""hello"""
Two clean string values, with the embedded comma and the doubled quote decoded correctly.
Frequently asked questions
How is the delimiter detected?
The tool counts the occurrences of the four common delimiters in the first few non-empty lines and picks the one that appears most often outside of quoted sections. If your file uses something unusual, convert it first or replace the separators.
What happens to a row with fewer columns than the header?
The missing cells are filled with an empty string, so every object in the array has exactly the same keys. That keeps the result usable by code that iterates over the keys without null checks.
Can I convert a CSV without a header row?
Yes. Switch off the header option and the first column becomes column_1, column_2 and so on, matching the position of each value.
Is a very large file a problem?
Very large files make the browser tab work harder, because the conversion and the JSON rendering both happen in memory. For files of a few megabytes it is fine; for hundreds of megabytes use a streaming command line tool instead.
What happens to duplicate column names?
The second occurrence is suffixed with an underscore and a counter, so a header row containing name twice becomes name and name_2 instead of one column silently overwriting the other.
How are quoted fields with newlines handled?
A quoted field may legally span several lines. The parser keeps the line break inside the value, so the resulting JSON string contains the newline as an escape sequence.
Are the values always strings?
Yes, and that is deliberate. A CSV has no type information, so guessing that 007 is a number and stripping the leading zero would change the data. Cast the fields in the language that consumes the JSON.
Can I paste a table copied straight out of a spreadsheet?
Yes, as long as the copy produces tab-separated text, which is what spreadsheets put on the clipboard. The tab delimiter is detected automatically and the result is the same as for a comma-separated file.
Why are the values all strings in the JSON?
Because CSV carries no type information. Keeping every value as a string means a zip code stays 007 and an identifier such as 00123 does not silently lose its leading zeros.
What happens to a column that is completely empty?
It is still part of the header, so every object has the key with an empty string as its value. That keeps the shape of the data stable across all the rows.
How large a file can it handle?
A few megabytes is comfortable. The JSON is built as one string and then rendered into the page, so the memory use grows with the size of the file.