CSV to JSON conversion turns rows of comma-separated values into structured JSON that code can use directly. Paste a CSV or drop in a file and the JSON updates as you change options. Your CSV never leaves your browser, and zip codes and phone numbers keep their exact text.
How do I convert CSV to JSON?
Paste CSV into the input box or upload a .csv, .tsv or .txt file, keep First row is header switched on, and the JSON appears on the right as an array of objects, one per row. Then copy it, download it as a .json file, or send it to the JSON Formatter. Nothing is uploaded.
When developers convert CSV to JSON
Typical uses are seeding a database or test fixture from a spreadsheet, writing mock API responses, importing configuration kept in a sheet, loading analytics exports into a script, and building REST request bodies. For placeholder records, the Mock Data Generator creates them from scratch. To describe the converted shape, try the JSON Schema Generator, and Compare JSON shows what changed between two conversions.
Why did my zip code stay a string?
A column becomes numbers only when every non-empty cell reads back exactly as written. A zip code like 02134 would turn into 2134 and lose its leading zero, so the whole column stays text. The same rule protects phone numbers starting with a plus sign or zero, long identifiers, and values such as 1e5.
How type inference decides
Inference is decided per column, all or nothing, so one field never mixes numbers and strings. A column becomes numbers when every non-empty cell is a plain number whose text survives conversion unchanged and fits JavaScript's safe integer range; 007, +91..., 1.50, -0, 0x1F and 1e5 keep the column as text. It becomes booleans when every cell is true or false in any letter case. Dates are never converted, and the word null stays text. Enable Allow trailing zeros to turn 12.50 into 12.5. When a column stays text, a notice above the output says why.
How do I convert a CSV with semicolon or tab delimiters?
Leave Delimiter on Auto-detect and the converter recognises comma, semicolon, tab and pipe separated files, including .tsv exports and the semicolon files that European versions of Excel produce. If a very small file is guessed wrongly, choose the delimiter yourself and the result updates straight away.
CSV quirks the parser handles
Quoted fields may contain the delimiter or line breaks, and a literal quote is written as two quotes. A UTF-8 byte order mark is removed. Excel on Windows often saves Windows-1252; if accented letters look garbled, set Encoding to Windows-1252 in Advanced options. A row with too few or too many fields gives a row-numbered warning instead of stopping the conversion.
Can I turn dotted column headers into nested JSON?
Yes. Switch on Nested keys from dotted headers and a header such as address.city becomes an address object containing a city key. If two headers conflict, for example address and address.city, both stay as flat keys and a notice explains why. Only dotted paths are supported, and numeric segments remain object keys, not array positions.
Round trip with the JSON Formatter's CSV export
The JSON Formatter exports nested objects and arrays as JSON text inside one cell, not as dotted columns. To restore them, enable Parse JSON objects/arrays inside cells in Advanced options; only cells starting with { or [ that are valid JSON are parsed. Some details cannot be recovered: null and an empty string both export as an empty cell, missing keys also become empty cells, and text that looks like a number or boolean converts back when type inference is on. Our guide to converting JSON to CSV, XML and YAML covers the other direction.
Worked example: with and without type inference
Both outputs below were copied from this converter with default settings, changing only the Type inference checkbox.
CSV input
id,name,zip,price,active
1,Ada,02134,19.99,true
2,Grace,10001,5,false
3,Alan,01001,7.5,TRUE
Type inference ON
[
{
"id": 1,
"name": "Ada",
"zip": "02134",
"price": 19.99,
"active": true
},
{
"id": 2,
"name": "Grace",
"zip": "10001",
"price": 5,
"active": false
},
{
"id": 3,
"name": "Alan",
"zip": "01001",
"price": 7.5,
"active": true
}
]
Type inference OFF
[
{
"id": "1",
"name": "Ada",
"zip": "02134",
"price": "19.99",
"active": "true"
},
{
"id": "2",
"name": "Grace",
"zip": "10001",
"price": "5",
"active": "false"
},
{
"id": "3",
"name": "Alan",
"zip": "01001",
"price": "7.5",
"active": "TRUE"
}
]
With inference on, id and price become numbers and active becomes booleans, but zip stays text because 02134 and 01001 would lose their zeros.
How to use this CSV to JSON converter
- Add your CSV by pasting it, choosing a file, or dropping a file on the upload box. Load sample CSV inserts an example.
- Pick a delimiter or leave Auto-detect on. Turn off First row is header for an array of arrays.
- Choose a shape: array of objects, array of arrays, or an object keyed by the first column. The key column is not repeated in each value, and if a key repeats the last row wins and the overwritten rows are listed.
- Set the indent to 2 spaces, 4 spaces, a tab, or minified.
- Open Advanced options for empty cells (empty string, null or omitted key), trimming, trailing zeros, JSON inside cells, and file encoding.
- Copy, Download as .json or Send to JSON Formatter. Results over about 2 MB show a preview in the box, but all three use the whole result.
- Large files over about 2 MB are parsed in the background, and live updates pause above about 1 MB, so press Convert.
What are the limitations of this converter?
Types are inferred from text, so the converter can only guess. Dates are never converted, the text null stays a string, and numbers beyond 2^53 stay strings. Only dotted paths nest: there is no tags[0] syntax, and items.0 produces an object with a key named 0. JavaScript lists integer-like keys first, so a column named 2024 may move ahead of the others. With the header off, Nested keys and Output shape are unavailable. Files over 100 MB are refused, and above about 25 MB the browser may be slow.
Is my CSV uploaded anywhere?
No. Your CSV never leaves your browser, and nothing you paste or upload is sent anywhere. Parsing and conversion run locally with a copy of the open-source PapaParse library served from this site. The page uses Google Analytics only to count visits and clicks on buttons such as Convert and Download, never your data or file names.