CSV to JSON Converter
Convert CSV to JSON and JSON to CSV instantly. Handles quoted fields, reads the first row as the header. Free, browser-based, no server required.
- Runs in your browser
- Tool input is not uploaded to ZeroTool servers
- Free · No Sign-Up
Scan with WeChat to share this tool
Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.
Worked Examples
Simple table
With the default options, unquoted numbers become JSON numbers and the rest stays text:
name,age,city
Alice,30,London
Bob,25,Paris
[
{
"name": "Alice",
"age": 30,
"city": "London"
},
{
"name": "Bob",
"age": 25,
"city": "Paris"
}
]
Repeated header and an extra field
A product export where two columns are both called sku and one row carries a fourth value:
sku,sku,qty
A-1,A-1-RED,3,boxed
[
{
"sku": "A-1",
"sku_2": "A-1-RED",
"qty": 3,
"column_4": "boxed"
}
]
The status line reads Converted 1 row to JSON. Duplicate header names were renamed: sku → sku_2. Some rows have more fields than the header, so these keys were added: column_4. Rename the columns in your source if you want other key names.
Quoted fields with commas
Input CSV:
product,description,price
Widget,"Small, round widget",9.99
Gadget,"Includes ""turbo"" mode",24.50
The description field contains a comma and escaped quotes — both are handled correctly. The price 24.50 becomes the JSON number 24.5.
Supported CSV Format
This tool follows the quoting rules of RFC 4180. Fields are separated by commas.
If a field contains a comma, newline, or double-quote, it must be enclosed in double quotes.
A literal double-quote inside a quoted field is escaped as two consecutive double-quotes ("").
The first row is always interpreted as column headers.
Edge Cases: What This Converter Does
Empty fields. In this CSV, Bob has no email and row 3 has no name. By default an empty field becomes "". With Empty → null ticked:
id,name,email
1,Alice,alice@example.com
2,Bob,
3,,charlie@example.com
[
{
"id": 1,
"name": "Alice",
"email": "alice@example.com"
},
{
"id": 2,
"name": "Bob",
"email": null
},
{
"id": 3,
"name": null,
"email": "charlie@example.com"
}
]
Type inference. With Parse numbers & booleans ticked (the default), unquoted true, false, and null (any case) become JSON literals. A value becomes a JSON number only when it is written in the JSON number syntax of RFC 8259 §6 (an optional minus, no leading zeros, no +, digits on both sides of a decimal point) and a JavaScript number keeps it exactly. Everything else stays a string so that nothing is lost: quoted fields ("42"), 007, +44, .5, integers above 2^53 − 1 such as long order IDs, in any form (1e21 stays the string "1e21", and an ID that a spreadsheet already wrote as 1.83E+18 stays visible as text instead of becoming 1830000000000000000), and values a double cannot hold (-0, 1e-400, decimals with more than about 17 significant digits):
code,value
plus,+44
zero,007
dot,.5
exp,1e3
negzero,-0
tiny,1e-400
[
{
"code": "plus",
"value": "+44"
},
{
"code": "zero",
"value": "007"
},
{
"code": "dot",
"value": ".5"
},
{
"code": "exp",
"value": 1000
},
{
"code": "negzero",
"value": "-0"
},
{
"code": "tiny",
"value": "1e-400"
}
]
1e3 is valid JSON number syntax and becomes 1000; 1.50 would become 1.5, because a JSON number has no trailing-zero form.
Header row. The first row is always the header. A CSV without one needs a header line added before converting. A repeated name gets a suffix (sku_2); a field beyond the last header gets the key column_N by position; missing trailing fields are treated as empty.
JSON → CSV. The input must be an array of objects. The columns are every key that appears in any object, in the order the keys first appear; a row without a key gets an empty field. Nested objects are flattened into dot-path columns such as user.name (the same layout as pandas json_normalize), arrays and empty objects are written as JSON text, and null becomes an empty field:
[
{ "id": 1, "user": { "name": "Alice", "city": "London" }, "tags": ["admin", "ops"], "manager": null },
{ "id": 2, "user": { "name": "Bob" } }
]
id,user.name,user.city,tags,manager
1,Alice,London,"[""admin"",""ops""]",
2,Bob,,,
Converting that CSV back to JSON does not rebuild the nesting: user.name stays a flat key and the array stays a string.
Limits
- Commas only. Tabs and semicolons are not separators. Tab-separated text, such as cells copied from a spreadsheet, becomes one field per line under a single long key.
- Quotes count only at the start of a field. A
"inside an unquoted field is text, so5" pipe,xgives the two fields5" pipeandx. A quoted field that is never closed stops the conversion with an error that names the line where it starts, and the JSON pane stays empty:
name,price
"Gadget, large,24.99
Widget,9.99
The status line reads Error: A quoted field that starts on line 2 is never closed. Add the closing " or remove the opening one.
- No other number formats. Thousands separators,
+signs, spaces around a number and full-width digits keep the value a string; remove them in the source if you need numbers. - Large JSON numbers keep their digits. A JSON number that a JavaScript number cannot hold exactly, such as
12345678901234567890,1e-400or-0, is written to the CSV as it appears in the JSON. This needsJSON.rawJSON, which Chrome 114, Firefox 135 and Safari 18.4 and later have. An older browser writes such a number as text (inside an array cell it gets quotes,"12345678901234567890"), and the status line lists those numbers. No number is written rounded. A number that a JavaScript number holds exactly is written as JavaScript writes it (ECMA-262 Number::toString), so1.50becomes1.5and1e21becomes1e+21. Converting that CSV back to JSON gives1.5and the string"1e+21", because whole numbers above 2^53 − 1 stay text:
[{ "price": 1.50, "views": 1e21 }]
price,views
1.5,1e+21
- Spaces in the header stay in the keys. RFC 4180 §2 counts spaces as part of a field, so
name, agegives the keys"name"and" age", and the value" 30"stays a string. The status line lists the header names that begin or end with whitespace (a full-width space counts too); remove the spaces in the source if you do not want them:
name, age
Alice, 30
[
{
"name": "Alice",
" age": " 30"
}
]
The status line reads Converted 1 row to JSON. These header names begin or end with whitespace, which stays part of the key: " age".
- Key order. JavaScript lists keys that look like whole numbers (
2024) before the other keys, in both directions. The values are not affected. - JSON syntax errors stop the conversion and leave the CSV pane empty. The status line names the line, the column and the cause in the page language; line and column count from the start of the JSON pane:
[{"id": 1, "name": "Alice",}]
The status line reads This is not valid JSON: line 1, column 27, trailing comma before the closing bracket.
FAQ
What CSV format is supported?
Comma-separated values with RFC 4180 quoting: a field wrapped in double quotes may contain commas, line breaks and doubled quotes (""). Rows may end with LF, CRLF or CR. Only the comma separates fields; tabs and semicolons stay inside the field.
How are headers handled?
The first row is always the header, and each later row becomes one JSON object with those names as keys. No value is dropped: a repeated name gets _2, _3 and so on (sku, sku_2), fields beyond the last header get keys named column_N by position, and the status line lists both. A row with fewer fields gets empty values. Spaces around a header name stay part of the key, because RFC 4180 counts them as part of the field: name, age gives the key " age". The status line lists such names.
Can I convert JSON back to CSV?
Yes. Paste an array of objects into the JSON pane. The columns are every key found in any object, in first-seen order; nested objects become dot-path columns such as user.name, arrays and empty objects are written as JSON text, and null becomes an empty field. The nesting is not rebuilt when you convert that CSV back.
Is there a maximum size?
The code sets no limit. The whole text is converted again each time you stop typing for 0.3 seconds, so a very large paste makes the page slower to respond. The tool reads pasted text only; it does not open files.
Can I paste cells copied straight from Excel or Google Sheets?
Not as they are. Cells copied from a spreadsheet arrive as tab-separated text, and this tool only splits on commas, so each whole line becomes one field under one long key. Save or download the sheet as CSV (comma-separated) and paste that text instead.
Is my data sent anywhere?
No. Both directions are converted in your browser tab. The CSV and JSON are not sent to a server and are not saved in browser storage. This tool sends no usage event; the page's analytics records only the page view.