Free tool · Developer tools
CSV to JSON converter
Paste CSV or choose a file and get a JSON array of objects or of arrays. Quoted fields, embedded commas and line breaks are handled, and the delimiter is detected for you. The conversion runs on your device, so your data is never uploaded.
- Free
- No sign-up
- Runs in your browser
3 rows4 columns, comma delimiter (detected)
- Types detected
| name | age | city | active |
|---|---|---|---|
| Smith, Anna | 34 | Lyon | true |
| Omar | 29 | Paris "Nord" | false |
| Lea | Nice | true |
- Rows
- 3
- Columns
- 4
- Delimiter
- comma, detected
- JSON size
- 268 chars
How to use the CSV to JSON
- Paste your data into Your CSV, or use Or choose a CSV file. The file is read on your device.
- Leave Delimiter on Auto-detect, or choose comma, semicolon, tab or pipe. Under Output choose an array of objects or an array of arrays.
- Under Options set First row is a header, number and true/false detection, empty cells as null, and trimming.
- Read the row and column counts, check the preview, then press Copy or Download. A message gives the line of any error.
How do I convert CSV to JSON?
Paste the CSV and the JSON appears under Result. With Array of objects, each row becomes an object keyed by the header row, so name,age followed by Ada,36 gives [{"name": "Ada", "age": 36}]. With Array of arrays, each row is a plain array of values, and if the header option is on, the header row comes first as an array of text.
The panel shows how many rows and columns were read, which delimiter was used and how large the JSON is, and a preview of the first rows lets you check that the columns line up before you copy anything. Download saves the result as data.json. The parser follows the rules of RFC 4180, the document that describes the common CSV format.
How do I use the first row as keys, and what are the types?
Tick First row is a header and its values become the keys. An empty header cell is named column2 and a repeated name gets _2, _3 and so on, each with a warning. Untick it and the keys are column1, column2, and every row is data.
CSV has no types: every value is text. With Detect numbers and true/false on, plain numbers become JSON numbers and true or false become booleans. Values that only look numeric stay text: 007, +5, 0x1F and 1.5.2 are not valid JSON numbers, and an id such as 12345678901234567890 has more than 15 digits, which a JSON number would round, so it stays a string and a chip says so. A value that was in quotes is never converted, which gives you a way to keep a zip code like "01234" as text. Empty cells become null turns 1,,3 into a null in the middle instead of an empty string.
How do I handle commas inside quoted fields, and other delimiters?
RFC 4180 says a field that contains a comma, a double quote or a line break must be wrapped in double quotes, and a double quote inside such a field is written twice. So "Smith, Anna" is one value and "Paris ""Nord""" is Paris "Nord". A quoted field may span several lines, and the line numbers in messages still count those line breaks. CRLF, LF and old-style CR line ends all work, and a byte order mark at the start of a file is ignored.
Many tools, including spreadsheet programs in some regions, write semicolons or tabs instead of commas. Auto-detect tries comma, semicolon, tab and pipe on the first rows and picks the one that gives the same number of fields on the most rows, ignoring delimiters inside quotes, so item;price with a value like 1,50 is split on the semicolon. If detection guesses wrong, choose the delimiter yourself.
What do the errors and warnings mean, and can I convert a big file?
A quote that is opened and never closed is an error, because everything after it would be swallowed into one value; the message gives the line where the quote opened, and Show the line in the box selects it. Other problems are warnings that name the line and still produce output: a row with fewer fields than the header (the missing values are null), a row with more (the extra values are kept as column5 and so on), a quote inside a field that is not in quotes, or text after a closing quote.
Large files are fine on a computer: the result appears shortly after you stop typing or choose the file, the box shows the first 200,000 characters and Copy and Download carry all of it. Files over 10 MB are refused with a message so the page does not freeze. Nothing is sent anywhere: the parser is code in this page.
Use it with
- JSON Formatter: format and validate JSON.
- YAML to JSON: convert YAML and JSON both ways.
- JSON Compare: diff two JSON documents.
Questions
How do I convert CSV to JSON?
Paste the CSV or choose a file. With a header row, each row becomes an object whose keys are the header values. The JSON appears at once and can be copied or downloaded.
How do I use the first row as keys?
Keep First row is a header ticked. Its values become the keys. Untick it to get column1, column2 and so on instead.
How do I handle commas inside quoted fields?
Wrap the field in double quotes and write any quote inside it twice, as RFC 4180 describes. The parser reads "Smith, Anna" as one value.
Can I convert a semicolon or tab separated file?
Yes. Auto-detect finds comma, semicolon, tab or pipe delimiters, or you can choose one yourself.
How do I convert a big CSV without crashing the browser?
The conversion runs after a short pause and shows the first 200,000 characters, while Copy and Download carry everything. Files over 10 MB are refused.
Why did my number stay in quotes in the JSON?
Values that were quoted, have a leading zero, or have more than 15 digits stay text so no information is lost. Tick off Detect numbers to keep everything as text.
How this page was made: the tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations were drafted with AI help and checked against the tool's own output.