Convert CSV to JSON Online
Turn a CSV export into a JSON array of objects: one object per row, keyed by the header, with numbers detected automatically. The CSV is read in your browser and never uploaded.
Drop a CSV or Excel file here
CSV · XLSX · XLS · XLSM · XLSB
Ready to download as a binary file.
How to convert CSV or Excel to JSON
Three steps from products.csv to JSON.
1. Paste or drop the CSV
Paste CSV text or drop a .csv, .tsv or .txt file; the delimiter is detected.
2. Check it in the grid
Check the header row: every column name becomes a JSON key. Rename vague or duplicate headers now, because duplicates collapse into a single key.
3. Pick a shape and copy
Choose a shape and an indent, then copy the JSON or download data.json.
Example: CSV in, JSON out
A product list where the SKUs have leading zeros, one name contains a comma and one stock count is missing.
sku,name,price,stock
0042,USB-C cable,9.90,120
0107,"Charger, 65 W",34.50,[
{
"sku": 42,
"name": "USB-C cable",
"price": 9.9,
"stock": 120
},
{
"sku": 107,
"name": "Charger, 65 W",
"price": 34.5,
"stock": ""
}
]The one lossy step is number detection: the SKU 0042 becomes 42 and 9.90 becomes 9.9. Use the 2D Array shape if codes and formatted prices must stay text.
What changes between CSV and JSON
Header row → keys
Each data row becomes one object, and the header text is used as the key exactly as written ("sku", "name", "price" and "stock"). Two columns with the same header end up as one key, and the last one wins, so rename duplicates in the grid first.
Numbers and text
A cell that parses as a number is written as a JSON number, anything else as a string. Here sku, price and stock come out unquoted. Watch out for codes with leading zeros: the sku "0042" turns into 42. The 2D Array shape skips number detection and keeps every value as text.
Empty cells
An empty cell becomes an empty string (""), never null: the empty stock for 0107 is written as "stock": "".
Detected delimiter: comma
The page counts commas, semicolons, tabs and pipes in the first line and splits on whichever appears most: 3 commas here. Quoted fields keep their delimiters and line breaks inside one cell.
When to convert CSV to JSON
- Seeding a front-end mock, a Storybook story or a test fixture from a spreadsheet export.
- Importing rows into MongoDB (mongoimport --jsonArray) or posting them to a REST API.
- Shipping a small lookup table (countries, plans, rates) with an app as a .json file.
CSV to JSON in JavaScript
TabularJS reads the CSV into a 2D array. Then each row is zipped with the header into an object.
import tabularjs from 'tabularjs';
// CSV values are strings; the header row stays in data[0]
const { worksheets } = await tabularjs('products.csv');
const [header, ...rows] = worksheets[0].data;
const records = rows.map((row) =>
Object.fromEntries(header.map((key, i) => [key, row[i] ?? '']))
);
console.log(JSON.stringify(records, null, 2));TabularJS returns CSV values as strings and leaves the header in data[0]. It does not guess the delimiter: comma is the default, so pass { delimiter: ';' } for semicolon files.
Frequently asked questions
Can I get an array of arrays instead of objects?
Yes. Choose 2D Array in the Shape menu: the first inner array is the header row and every value stays a string, exactly as it was in the CSV.
How do I turn the JSON back into CSV?
Use the JSON to CSV converter. The text formatting of numbers is lost on the way (9.90 became 9.9), so keep the original CSV if the exact text matters.
My CSV uses semicolons or tabs. Do I need to change anything?
No. Whichever of comma, semicolon, tab or pipe appears most often in the first line is used as the delimiter. The JSON is built from the cells, so the input delimiter doesn't matter after that.
Can I get JSON Lines (NDJSON) instead of an array?
Yes. Choose JSONLines in the Shape menu: every row is written as one compact JSON object on its own line, with no surrounding brackets.
Does products.csv get uploaded when I convert it to JSON?
No. The CSV is read in your browser and never uploaded.