Home / Free tools / Text & Data / CSV and JSON Converter
CSV and JSON Converter
Turn a CSV table into JSON, or an array of JSON records into a CSV file. Delimiters are detected, identifiers keep their leading zeros and nothing is uploaded.
Runs in your browser. Nothing you paste or choose is uploaded or stored.
What this converter does
This tool turns a table into JSON and JSON back into a table. Paste or open a CSV file and you get a JSON array that a developer, a script or an API can use; paste a JSON array of records and you get a CSV file that opens in Excel, Google Sheets or a feed upload form. The conversion happens in your browser and your data is never uploaded, which matters when the file holds customers, prices or orders.
CSV (comma-separated values) looks simple but has many dialects. Some files use semicolons because the spreadsheet that wrote them uses a decimal comma, some use tabs, and some fields contain line breaks inside quotes. The converter detects the delimiter, follows the quoting rules of RFC 4180 and reports problems instead of silently dropping rows.
How the conversion works
- CSV to JSON. With "first row contains column names" on, every later row becomes an object whose keys are the column names. Without it, or with the "array of arrays" shape, rows stay as lists. Quoted fields may contain commas, line breaks and doubled quotes (
""means one quote character). - Value detection. When detection is on,
12.5becomes the number 12.5,trueandfalsebecome booleans, and empty ornullcells become null. Text that only looks like a number but would lose information stays text: anything with a leading zero (such as the GTIN 0012345678905 or the postcode 02134) and anything of 16 digits or more. Switch to "keep everything as text" if you want no conversion at all. - JSON to CSV. The input must be an array of objects, or an object that holds one. The columns are the union of all keys, in the order they first appear, so records with different keys still line up. Nested objects and arrays are written into the cell as JSON text, so no data is lost.
- Quoting. A cell is wrapped in quotes when it contains the delimiter, a quote, a line break, or spaces at either end, and quotes inside are doubled.
- Limits. Up to 200,000 rows are converted; larger files should be split first.
Worked example
Load the CSV example. It has a header row sku,gtin,price,in_stock and two products. With value detection on, the first product becomes {"sku":"MUG-01","gtin":"0012345678905","price":12.5,"in_stock":true}. Three things are visible: 12.50 became the number 12.5, the GTIN kept its two leading zeros because it is not a safe number, and "true" became a real boolean. The second product has price 13 and in_stock false. Switching the direction to JSON to CSV and loading its example does the reverse: two objects become a header row and two data lines, and the tags array of the first product is written into its cell as ["a","b"].
Opening the result in Excel and Sheets
Excel guesses the type of every cell when it opens a CSV file. It strips leading zeros from codes, turns long numbers into scientific notation, and may read 1-2 as a date. If product codes matter, import the file through the data import dialog and mark those columns as text instead of double-clicking the file. In countries where the decimal separator is a comma, Excel expects a semicolon as the delimiter, so choose "Semicolon" for the output.
Spreadsheet formula injection
A cell that begins with =, +, - or @ can be run as a formula when the file is opened in a spreadsheet. If your JSON comes from untrusted text, such as customer names or reviews, an attacker could craft a value that runs a command or leaks data. Turn on the formula protection option and the converter adds an apostrophe in front of such cells, which is the standard defence recommended by OWASP. Plain negative numbers such as -5 are left alone.
Related tools
- Check that your JSON is valid first with the JSON formatter and validator.
- Clean the text in a column with the case converter, which also removes duplicate lines.
- Working on a product feed? The feed checker inspects a CSV or TSV feed for missing fields.
- More utilities are collected under Text and data.
Questions
Why did my postcodes and GTINs keep their leading zeros?
Values with a leading zero are identifiers, not quantities, and turning them into numbers would delete the zeros. The converter therefore leaves them as text, along with numbers of 16 or more digits that a JavaScript number could not hold exactly.
How does it detect the delimiter?
It looks at the first line, which normally holds the column names, and picks the delimiter among tab, comma, semicolon and pipe that splits it into the most columns. If your header contains one of the others inside a name, choose the delimiter yourself.
What happens to nested JSON when I convert to CSV?
Objects and arrays inside a record are written into their cell as JSON text, with the usual quoting. Nothing is dropped, and converting back gives you the text, which you can parse with a JSON tool.
Can it handle files with line breaks inside cells?
Yes. A quoted field may contain line breaks, commas and doubled quotes. A quote that is never closed is reported as a warning, because the rest of the data then ends up in one cell.
Is there a size limit?
Files up to 20 MB and 200,000 rows are converted. Larger files should be split first, because the whole table is held in your browser's memory.
Is my data uploaded?
No. The conversion runs in your browser and the data is not sent to a server or saved.
Why use semicolons for the CSV output?
Spreadsheet programs in many European locales use a comma as the decimal mark and therefore expect semicolons between columns. If your CSV opens as one wide column, convert it again with the semicolon option.
Google, Merchant Center, YouTube, LinkedIn, Indeed, Glassdoor and Shopify are trademarks of their owners. Van Born Labs is independent and not affiliated with them. Google's own help pages are the final word on its rules.