How to convert CSV text into JSON records
CSV is a grid. JSON, when it is used as an API payload or a config file, is usually a list of named records. The mechanical part of the conversion is easy: take the first row as keys, and turn every following row into an object. The part that bites people is everything around that: a byte order mark glued to the first header, a comma that lived inside quotes, a ZIP code that lost its leading zero because someone “helped” by turning it into a number, or an order ID that became 1.23457e+17 because the file was opened in Excel on the way here.
This page reads the CSV in your browser, shows both a table preview and a JSON preview, and lets you download a .json file. Nothing is uploaded.
- Paste the CSV or drop a file. Tab-separated text and semicolon-separated European exports are detected automatically. A UTF-8 BOM is stripped so the first key is
Order ID, not\uFEFFOrder ID. - Choose how the JSON should look. By default the first row is treated as headers, the output is pretty-printed, and every cell stays a string. That last choice is deliberate, and it is explained below.
- Read both previews. If a field such as
Leave at the door, side entrancesplit into two properties, the quotes in the source were wrong. If a long ID lost digits, the damage happened before the text reached this page. - Download JSON. The file is UTF-8, without a BOM, which is what
JSON.parse, Python’sjson.load, and most HTTP clients expect.
Use the button to try a file that starts with a BOM and includes a quoted comma, a leading zero, the 18-digit ID 123456789012345678, and the name 张伟.
Headers, duplicate columns, and empty cells
Each header becomes a property name. A blank header is named column_2, column_3, and so on, rather than becoming the empty string, which is legal JSON and miserable to use. If the same header appears twice, the second column is named City_2 rather than silently overwriting the first. That is a data smell you should fix in the source when you can, but it is better than dropping a column on the floor.
If you turn off “First row is a header,” the download is a JSON array of arrays: the raw grid, including that first row. Use this when the CSV has no header, or when you want to keep the header as ordinary data.
Empty cells become empty strings, not null. That distinction matters to some schemas, and inventing null for a blank field is a policy this page will not choose on your behalf. You can map empty strings to null in one line of your own code after you download.
Why values stay strings unless you ask otherwise
It is tempting to convert 42 to a number and true to a boolean. The danger is not those two values. The danger is everything that looks like a number and is not a quantity: 00123, an 18-digit order ID, a US ZIP code from New Jersey that starts with 0, a phone number, a barcode. JSON numbers also cannot represent integers with more than 15 or 16 significant digits faithfully once a JavaScript runtime has seen them.
The default, therefore, is that every cell is a string in the output. Your program can number-convert the columns it knows are quantities. The optional “Convert simple numbers and booleans” setting will turn true, false, null, and ordinary short numbers into real JSON types, while still leaving leading zeros and 16+ digit identifiers as strings. Leave it off when you are unsure.
If the CSV has already been through Excel and an identifier column now says 1.23E+17, this converter will faithfully give you the string "1.23E+17". That is accurate, and it is also not the original ID. Fix the identifiers first with the scientific notation tool, or go back to a source that never passed through Excel’s number type.
Quoted commas, encodings, and what can go wrong before you paste
Fields wrapped in double quotes may contain commas and newlines. A literal quote inside a field is two quotes in a row. This parser follows that rule, so a city written as "London, UK" becomes one property. If your source system writes unquoted commas, no parser can know where the field was supposed to end; you will see the breakage in the preview.
The input is decoded as UTF-8, or as UTF-16 when a file starts with a UTF-16 BOM. Excel on Windows sometimes saves “CSV” in a legacy ANSI code page instead. If Chinese text already looks wrong in the paste box, the file is not UTF-8; re-export it as UTF-8, or open it in a text editor and save it as such, before you convert. This page will not guess a locale-specific ANSI code page, because a wrong guess corrupts the data in a second, different way.
What this page does not do
It does not fetch a Google Sheet or a database for you, and it does not invent a nested schema from flat columns. If you need the opposite direction, use the JSON to CSV converter. If the table is on a web page rather than in a file, the Table to Excel & CSV Chrome extension can export it, and you can then convert the CSV here.
Frequently asked questions
Is my CSV uploaded?
No. Detection, preview, and JSON generation all run locally in your browser.
Why does the JSON file not start with a BOM?
Because a BOM in a .json file breaks some parsers, including several older JavaScript environments and picky API gateways. UTF-8 without a signature is the standard for JSON.
How are very long identifiers represented?
As strings, always, even when type conversion is on. That is the only way to keep every digit, including values above JavaScript’s safe integer range.
Can I pretty-print, or get a compact one-line file?
Yes. Pretty-print is on by default. Turn it off for a compact payload.
Is there a row limit?
No cap is imposed, but a huge file can make the browser sluggish. The table preview shows the first twelve rows; the JSON preview and the download include every row.
Is this affiliated with Microsoft Excel?
No. This is an independent tool. If your CSV came from Excel, you may still want to read the notes above about encoding and identifiers.