Convert CSV to a JSON array of objects, using the header row as keys. Comma, semicolon and tab separators are detected, and values stay as text.
What is CSV to JSON?
CSV to JSON is a free online tool that converts CSV text, in your browser, into a JSON list of objects, one per row, using the first row as the names. It reads comma, semicolon or tab separated text, follows the quoting rules of RFC 4180, and keeps every value as plain text, without guessing types.
It either converts every row or refuses and tells you which line does not fit.
What it supports
- Plain CSV text: a header row first, then one row per record, with the same number of fields in every row.
- The separator is detected from the header row: a comma, a semicolon or a tab, whichever appears most often outside double quotes (a comma when they tie). The same separator is used for every row.
- A field can be in double quotes. Inside quotes, a separator, a line break and a double quote written as two double quotes are all plain text. A double quote in the middle of an unquoted field, as in 5" pipe, is kept as it is.
- Rows can end with a line feed, a carriage return plus a line feed, or a lone carriage return. Blank lines and the final line break are skipped, and a byte order mark at the start is ignored.
- The first row gives the names, in column order. Every value is a JSON text exactly as it appears in the CSV, so 007, 1.50 and true stay text and an empty cell is an empty text. A header with no rows below it gives an empty list, [].
- A name that repeats gets _2, _3 and so on, and an empty name is called column_ followed by its position. Either one adds a warning, and the new names never clash with a name that is already there.
- The result is a JSON list, written with the indentation you choose, 2 or 4 spaces.
Good to know
- Types are not guessed. Numbers, true, false and empty cells all stay text, because a CSV does not say what type a column has. Convert them in the program that reads the JSON if you need real numbers.
- The first row is always the header. If your file has no header row, its first record becomes the names.
- A row with more or fewer fields than the header is refused, and so are a quoted field that never closes and text right after a closing quote. The message gives the line of the problem. Nothing is repaired, padded or cut.
- Only one separator is used for the whole file. If a file mixes semicolons and commas between fields, the one that is more frequent in the header row wins, and rows that no longer fit are refused.
- This tool reads CSV text, not spreadsheet files such as .xlsx. Export the sheet as CSV first.
- A large table can give a result bigger than your input, because every value gets quotes and a name. If it passes the size limit, it is refused with an incomplete preview (see below).
How do I use CSV to JSON?
- Paste or type your CSV in the input box. The first row must hold the column names. Nothing runs while you type.
- Choose the indentation (“2 spaces” or “4 spaces”) and press “Convert”.
- Read the JSON next to your input. If a column name is repeated or empty, a warning in the result area says how it was renamed. If the conversion is refused, the message says why and gives the line.
- Press “Copy” to put the JSON on your clipboard, or “Download” to save it as converted.json.
Examples
A table with a header
Paste this CSV and press “Convert”. The first row gives the names and every other row becomes one object. Every value is text, even the numbers, which is why “1” is written in quotes.
id,name,city
1,Ada Lovelace,London
2,Grace Hopper,New York[
{
"id": "1",
"name": "Ada Lovelace",
"city": "London"
},
{
"id": "2",
"name": "Grace Hopper",
"city": "New York"
}
]A row with too few fields
The last row has one field but the header has two, so the tool refuses instead of guessing which value is missing. The message gives the line of the row, which is line 3 here.
id,name
1,Ada
2This row has a different number of fields than the header row. Every row needs the same number of fields. Look for a missing or extra delimiter, or for a field that contains a delimiter or a line break and is not in double quotes.
Line 3, column 1
Semicolons and quotes
Spreadsheet programs set to Portuguese or Spanish often save CSV with semicolons, and the tool detects the separator on its own. The comma inside “Café, moído” belongs to the value because the value is in double quotes. “001” keeps its leading zeros and “12,50” stays text.
código;descrição;preço
001;"Café, moído";12,50
002;Pão;7,90[
{
"código": "001",
"descrição": "Café, moído",
"preço": "12,50"
},
{
"código": "002",
"descrição": "Pão",
"preço": "7,90"
}
]A repeated column name
Two columns are both called “name”. JSON names must be unique, so the second one is renamed name_2 and a warning says so. An empty column name is named column_ followed by its position, such as column_1, and also adds a warning.
name,name
Ada,Lovelace[
{
"name": "Ada",
"name_2": "Lovelace"
}
]One column name in the header row repeats an earlier one. It was renamed by adding _2, _3 and so on, so every JSON key stays unique.
Limits and privacy
Size limits
- Input: up to 2,000,000 bytes of UTF-8 text (about 2 MB). Accented letters and emoji take more than one byte each. Larger input is rejected.
- Result: also up to 2,000,000 bytes. If the complete result would be larger, the tool shows only an incomplete preview of the first 100,000 bytes, and that preview cannot be copied or downloaded.
- Time: a run that takes longer than its time limit is stopped. Try a smaller input.
Is my text sent to a server?
No. The text you type or paste, or open from a local file, is processed locally in your browser, in a dedicated Web Worker. It is never uploaded or sent to the server (a file you open is read in your browser only), and it is not written to storage, cookies or the address bar.
“Copy” puts the result on your clipboard and “Download” saves it as a file, but only when you press the button. The file is created in your browser, so nothing is uploaded.
For the full details, see the Privacy Policy
Related tools and pages
Your text stays in the page when you switch tools in the same tab, so you can try the same text in another tool. Reloading or closing the tab ends it.