To convert a CSV file to JSON, open our free CSV to JSON converter, drop in the file or paste the data, and click Download JSON. You get an array with one object per row, keyed by the header row. Amounts become JSON numbers, while ZIP codes, product codes with leading zeros and long IDs stay strings, so nothing your app relies on is changed. The conversion runs in your browser; the file is not uploaded.
A worked example
Input CSV:
order_id,zip,amount,discount,paid,created,note
1234567890123456789,02134,"1,250",0.75,TRUE,2026-12-05,
Output JSON (with "Save numbers as numbers" ticked):
[
{
"order_id": "1234567890123456789",
"zip": "02134",
"amount": 1250,
"discount": 0.75,
"paid": "TRUE",
"created": "2026-12-05",
"note": ""
}
]
What happened to each value:
| Column | Became | Why |
|---|---|---|
| order_id | string | 16 or more characters always stay strings, so no digits are lost in any tool that reads the JSON |
| zip | string "02134" | starts with 0 followed by a digit, so it is a code, not a number |
| amount | number 1250 | a plain number; thousands commas are understood |
| discount | number 0.75 | a zero before the decimal point is a normal number |
| paid | string "TRUE" | text that looks like a boolean is left as text |
| created | string | dates are kept exactly as written |
| note | empty string "" | empty cells become empty strings |
Untick "Save numbers as numbers (Excel and JSON). Leading zeros are always kept." and every value becomes a string. Choose that when the receiving system does its own type conversion.
Step by step
- Open CSV to JSON.
- Choose or drop a CSV, TSV or TXT file up to 50 MB, or paste rows into the box.
- Check the preview of the first 100 rows. The column names there become your JSON keys.
- Decide on the number option (above).
- Click Download JSON. The file is indented with two spaces, so it is readable in any editor.
How the keys are made
The first non-empty line is the header row, and each header becomes a key, with a few clean-ups so every key is usable:
- spaces at the ends are removed and runs of spaces inside are reduced to one;
- an empty header becomes
column_1,column_2and so on, by position; - a repeated header gets a number: two
amountcolumns becomeamountandamount_2; - completely empty rows are skipped.
Keys keep their original case and inner spaces. If your app expects snake_case keys, rename the headers in the CSV before you convert.
Separators and encodings
The converter checks your file with comma, tab, semicolon and pipe, and uses the one that splits the rows most consistently, so semicolon files from European versions of Excel work without changes. A .tsv file is always read as tab separated.
Encoding is detected too: UTF-16 by its marker, otherwise UTF-8, with a fallback to Windows-1252 for older exports. If accented names look wrong in the preview, see fixing CSV encoding.
Why IDs must stay strings
JavaScript and many JSON parsers store numbers as 64-bit floating point, which holds integers exactly only up to 9,007,199,254,740,991 (16 digits). An 18 or 19 digit order ID stored as a JSON number will be silently rounded by those parsers. Keeping it as a string avoids that, and it is the same reason long IDs break in spreadsheets: see why Excel turns long numbers into scientific notation.
Codes with leading zeros are the other trap. 02134 as a number is 2134, which is no longer a valid ZIP code.
Limits and edge cases
| Situation | What happens |
|---|---|
| File over 50 MB | Not accepted; split it first |
| More than 2,000 columns | Stops with a message naming the column count |
Dotted headers such as address.city | Kept as flat keys; no nesting is rebuilt |
| An empty file | An error message, no download |
Values like $99 or 15% | Strings, exactly as written |
Negative numbers such as -42 | Numbers |
Using the file in code
The output is standard JSON, so any language reads it directly:
import json
rows = json.load(open("orders.json", encoding="utf-8"))
total = sum(r["amount"] for r in rows if isinstance(r["amount"], (int, float)))
const rows = await (await fetch("orders.json")).json();
const ids = rows.map(r => r.order_id); // strings, every digit intact
Two habits keep the data safe once it is loaded:
- Treat ID and code fields as strings in your own code too. Converting them with
int()orNumber()brings back the problems described above. - Check for empty strings. An empty cell arrives as
"", notnulland not0, so a sum over a column with blanks needs the type check shown in the Python example.
When JSON is the better choice
| You are sending the data to | Better format |
|---|---|
| A web app, an API or a script | JSON: types are explicit and nothing reinterprets your codes |
| Someone who will open it in Excel | An Excel file, not CSV or JSON |
| A database bulk import | Usually CSV, which most import tools expect |
| A config file or test fixture | JSON |
JSON is larger than the same data in CSV because every row repeats the keys. For very large tables that will only ever be read by a database, CSV stays the leaner choice.
Going the other way, and from Excel
- JSON to CSV: our JSON to CSV converter flattens nested records into dotted columns. The rules are explained, with a real record, in how to convert nested JSON to CSV.
- Excel to JSON: for a workbook, use Excel to JSON, which applies the same number rule to the sheet you pick.
More free file tools are on the tools page.
Frequently asked questions
What does the JSON look like?
An array with one object per row. Each object uses the header row as its keys, in the same order as the columns.
Will numbers be numbers in the JSON?
Yes, if Save numbers as numbers is ticked (the default). Codes that start with 0 and values of 16 or more characters stay strings, so IDs and ZIP codes are not damaged. Untick it to make every value a string.
What happens to empty cells?
They become empty strings, not null. If your app needs null, replace empty strings after loading the file.
Can it rebuild nested JSON from dotted column names?
No. A column called address.city stays a key with a dot in it. The output is always flat: one level of keys per object.
Spotted an error? Write to dealmahal.official@gmail.com.
Questions or corrections: dealmahal.official@gmail.com.