The first CSV row becomes the keys, and each data row becomes one JSON object
CSV is a table in which commas separate cells and line breaks separate rows. A JSON array of objects is a list of name-and-value objects placed between square brackets [ ]. Both can hold the same data. The column names in the first CSV row become the keys of each object, and every row below it becomes one object. In the example above, the first row 'sku,name,price,stock,notes' gives five keys, and the three data rows give three objects. Going the other way, the converter collects the keys that appear in the objects, turns them into columns, and writes each object as one row.
The converter works as soon as you paste text or open a file. It chooses the delimiter itself, whether a comma, tab, semicolon or pipe, and by default it leaves values with leading zeros, such as 0012, exactly as written. JSON with objects inside objects, like an API response, is flattened into columns such as 'customer.name'. In the table view below, a bar for each column shows how many numbers, text values and empty cells it holds, and clicking a row number shows in the row breakdown which object or CSV line that row became. If the quotes or the number of cells are wrong, the message points to the line where it happens. Your text and files are not sent to a server; they are processed only in this browser.
When to convert between CSV and JSON
- Sending a spreadsheet list to a web service: you keep products, members or stock in a spreadsheet, and an API or admin tool expects a JSON array. Convert the CSV to JSON and paste it in one go.
- Reading an API response or a log as a table: JSON converted to CSV can be sorted and filtered in Excel or Google Sheets. Even when the response is wrapped, as in { "data": [ … ] }, you can pick the array inside and tabulate it.
- Preparing settings, translations or test data: collect the values in a spreadsheet that several people can edit easily, then export them as the JSON a program reads.
- Connecting two programs that accept different formats: if one tool exports only CSV and the other imports only JSON, convert in between.
Conversion rules
- Reading CSV: the delimiter splits cells and line breaks split rows. A cell containing the delimiter, a double quote or a line break is wrapped in double quotes, and a double quote inside a cell is written twice (""). Spaces are kept as part of the value (RFC 4180). Completely empty lines are skipped, except in a one-column CSV, where an empty line is read as an empty value.
- Column names: the first row supplies the keys. If a name is empty or appears twice, it is impossible to tell which value belongs to which key, so the conversion stops. If the first row is already data, set 'First row' to 'Data'; the keys then become column1, column2 and so on.
- Checking cell counts: every row must have as many cells as the first row. The converter does not guess missing cells or drop extra ones; it reports the line that does not match.
- Values: the default 'All as text' copies every cell as a string. With 'Detect numbers', cells that follow the rules in the table below become numbers, true or false, or null.
- JSON → CSV: the keys of all the objects are collected in the order they first appear and become the columns. A key that an object lacks, and null, become an empty cell. An object inside an object is expanded into a name joined with dots (.), and an array is expanded with indexes starting at 0.
- Writing CSV: only cells containing the delimiter, a double quote or a line break are wrapped in double quotes, and lines end with CRLF. A BOM for Excel is added at the start only when you save, never to copied text.
What counts as a number
CSV has no data types, so every cell is text. 'Detect numbers' converts a cell to a number only if it follows JSON number syntax and turns back into the same text afterwards. JSON syntax does not allow leading zeros, so 0012 is not a number (RFC 8259). The largest integer a browser handles exactly is 9,007,199,254,740,991 (253 − 1), so a larger order number stays as text.
| CSV cell | All as text | Detect numbers | Reason |
|---|---|---|---|
0012 | "0012" | "0012" | A leading zero is not valid JSON number syntax |
25900 | "25900" | 25900 | Integer |
1.50 | "1.50" | 1.5 | Same value; the trailing zero disappears |
1e3 | "1e3" | 1000 | Exponent notation is a number too |
TRUE | "TRUE" | true | true and false ignore letter case |
null | "null" | null | Only lowercase null |
| (empty cell) | "" | "" | Stays an empty string |
9007199254740993 | "9007199254740993" | "9007199254740993" | Outside the safe integer range |
0.1234567890123456 | "0.1234567890123456" | "0.1234567890123456" | 16 significant digits cannot be stored exactly |
-0 | "-0" | "-0" | As a number it would become 0, so it stays text |
"1,234" | "1,234" | "1,234" | A value with a thousands comma is text |
For values you never calculate with, such as product codes, ZIP codes or phone numbers, 'All as text' is the safe choice. 'Detect numbers' decides cell by cell, not by column: codes that start with 0 stay text, but codes such as 1234 or a single 0 fit the number syntax and become numbers, so one column can end up mixing text and numbers. If you have a code column, keep 'All as text'.
Flattening nested JSON such as an API response
The JSON → CSV example is a response whose order list sits under the 'orders' key. When the outermost value is an object, the converter looks inside it for an array of objects and tabulates that one; if there are several, it picks the array with the most items first. To use another array, or the whole object as one row, change 'Array to tabulate' above the input. An object inside an object is joined with a dot, as in 'customer.name', and an array gets an index, as in 'tags.0' and 'tags.1'.
| id | customer.name | customer.city | qty | paid | tags.0 | tags.1 | note |
|---|---|---|---|---|---|---|---|
| A-0012 | Emma | Boston | 2 | true | new | coupon | |
| A-0013 | Liam | Denver | 1 | false |
The second order has no 'tags', and its 'note' is null, so those cells are empty. An empty object { } and an empty array [ ] are kept in the cell as the text {} and [], so they are not mistaken for a value that disappeared. If you convert the flattened CSV back to JSON, 'customer.name' becomes a single key that contains a dot, and the nested structure does not return. JSON Lines (.jsonl), which has one object per line, can also be pasted directly and is read as one row per line.
Opening and saving in Excel
- Keeping accented and non-Latin characters intact: Microsoft explains that a UTF-8 CSV saved with a BOM (byte order mark) opens correctly in Excel the usual way. That is why 'BOM for Excel' is on by default when you save a CSV. A file without a BOM can be opened through Data › Get Data › From File › From Text/CSV, where you can choose the encoding.
- Semicolon CSV: the default list separator Excel uses when saving CSV is the comma, but it can be changed in the Windows Region settings, and then every program uses that character. So depending on the regional settings, a CSV may come out split by semicolons. Delimiter 'Auto-detect' also recognizes semicolons, and you can change the delimiter of the CSV output.
- Cells copied from Excel: when you copy cells in Excel or Google Sheets and paste them here, the cells arrive separated by tabs. Auto-detect picks the tab, so you can convert without saving a file first.
- Older encodings: a file that cannot be read as UTF-8 is read again as Windows-1252, the code page used by Western European versions of Windows, and a note above the input says which encoding was used.
- Excel workbooks: .xlsx and .xls files are compressed workbooks and cannot be opened directly. Save the sheet as CSV in Excel, then open that.
CSV syntax follows RFC 4180, JSON syntax and number range follow RFC 8259, and the BOM, list separator and leading-zero notes in the Microsoft Support documents were checked on 2026-10-20.
What is lost on the way through CSV
A CSV cell holds only text, so JSON data types do not survive a trip through CSV. These are the things that change when you go JSON → CSV → JSON.
| Original JSON | CSV cell | JSON again (All as text) |
|---|---|---|
"note": null | (empty) | "note": "" |
"note": "" | (empty) | "note": "" |
| key missing | (empty) | "note": "" |
"qty": 3 | 3 | "qty": "3" |
"paid": true | true | "paid": "true" |
"customer": {"name": "Emma"} | Emma in the customer.name column | "customer.name": "Emma" |
If your data needs to tell null, an empty string and a missing key apart, keep the original JSON as well or add a column that records the state. Numbers and true or false can be restored with 'Detect numbers', but a value that was originally the string "3" also becomes a number. The bars in the table view show the kind of the original JSON value, so a cell that was null is colored as 'Boolean/null' and kept apart from an empty cell.
Common mistakes
- A comma inside a value is not wrapped: writing Boston, MA without double quotes adds one cell and produces an error such as 'This row has 6 cells'. Wrap the whole cell, as in "Boston, MA".
- A quote in the middle of a cell: for Laptop stand "Alu", the whole cell must be wrapped and the inner quotes doubled, so it is written "Laptop stand ""Alu""".
- Pasting CSV without a header row as it is: the first data row becomes the column names and one record goes missing. Set 'First row' to 'Data'.
- Writing a big number as a JSON number: an integer such as 9007199254740993 without quotes changes the moment a browser reads it. This converter stops when it meets such a value and asks you to wrap it in double quotes as a string.
- Writing the same key twice in one object: the JSON standard recommends that names within an object be unique (RFC 8259). If a key appears twice, this converter keeps only the last value.
- 0012 turns into 12 when you open the CSV in Excel: the converted output still contains 0012, but Excel removes leading zeros and shows large numbers in exponent notation such as 1.23E+15. Excel handles only 15 significant digits, so the last digits of a card or order number longer than 15 digits become zeros. Import with Data › From Text/CSV and set that column to Text.
Limits and cautions
- The converter handles input up to 5 MB (5,242,880 bytes), 200,000 cells including the header, and output up to 10 MB. Split larger data by rows and give each part the same header.
- The table view draws only the first 100 rows and 60 columns. Converting, copying and saving always use all of the data.
- CSV → JSON always produces a flat array of objects. Column names that contain a dot are not turned back into nested objects.
- JSON Lines is read-only. To get one object per line as output, use a JSON array ↔ JSONL converter.
- Decimals in JSON become double-precision numbers when the browser reads them, so a very long decimal may differ in its last digits. Put values whose digits must be preserved in strings.
- A cell that starts with =, +, -, @ or a tab can be interpreted as a formula by Excel (OWASP calls this CSV injection, or formula injection). This converter does not change values, so when you open converted data of unknown origin in Excel, first check whether such cells exist.
Sources
- 01IETF — RFC 4180: Common Format and MIME Type for CSV Files2005, Informational. §2: CRLF line endings, optional header line, the same number of fields on every line, spaces are part of a field, fields with line breaks, double quotes or commas are enclosed in double quotes, an inner double quote is doubled. Checked 2026-10-20
- 02IETF — RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format§4 names within an object SHOULD be unique, §6 no leading zeros, integers in [−(253)+1, (253)−1] interoperate, §8.1 UTF-8 and no BOM
- 03JSON LinesUTF-8, one JSON value per line, line terminator '\n', extension .jsonl
- 04Microsoft Support — Opening CSV UTF-8 files correctly in ExcelA UTF-8 CSV saved with a BOM opens the usual way; otherwise Data › Get Data › From File › From Text/CSV
- 05Microsoft Support — Import or export text (.txt or .csv) filesThe default list separator for saving CSV is the comma; changing it in Windows Region settings applies to all programs
- 06WHATWG — Encoding StandardLabels and index for windows-1252 (including latin1, iso-8859-1 and ascii), EUC-KR and Shift_JIS
- 07MDN — Number.MAX_SAFE_INTEGER253 − 1 = 9,007,199,254,740,991; larger integers cannot be represented safely
- 08Microsoft Support — Keeping leading zeros and large numbersExcel removes leading zeros and shows large numbers in exponent notation, 15 significant digits, import with From Text/CSV and set the column to Text
- 09OWASP — CSV InjectionDefinition of formula injection and the risky first characters (=, +, -, @, tab, carriage return)
Frequently asked questions
How do I convert CSV to JSON?
Paste the CSV into the input box or open a file, and a JSON array of objects appears in the output right away. The column names in the first row become the keys, and each row below becomes one object. Copy it or save it as a .json file.
Do leading zeros like 0012 disappear?
No. The default 'All as text' copies every cell as a string, so 0012 becomes "0012". Even with 'Detect numbers', a value that starts with 0 does not fit JSON number syntax, so it stays text.
How do I get prices and quantities as numbers instead of strings?
Set 'Values' to 'Detect numbers'. Then 25900 becomes the number 25900, true and false become booleans, and null becomes null. Integers above 9,007,199,254,740,991 and decimals with 16 or more significant digits stay text so their values do not change.
The converted CSV shows garbled characters in Excel. What can I do?
Keep 'BOM for Excel' switched on when you save. It is on by default, and a UTF-8 CSV with a BOM opens correctly in Excel. For a file without a BOM, use Data › Get Data › From File › From Text/CSV and pick UTF-8 as the encoding.
Can it convert files separated by semicolons or tabs?
Yes. Delimiter 'Auto-detect' checks the first 20 lines and picks the comma, tab, semicolon or pipe that gives the same count on every line. Cells copied from Excel arrive tab-separated and convert as they are. You can also choose the delimiter of the CSV output.
Can nested JSON or an API response be converted to CSV?
Yes. If the outermost value is an object, the converter finds the array of objects inside it and tabulates it. An object inside an object is flattened with dots, as in 'customer.name', and an array with indexes, as in 'tags.0'. Pick another array in 'Array to tabulate', and JSON Lines with one object per line is read too.
What if my CSV has no header row?
Set 'First row' to 'Data'. The first row is then read as data and the keys are named column1, column2 and so on automatically. Without that, the first data row becomes the column names and one record is lost.
Is my data sent to a server?
No. Pasted text and opened files are converted only inside this browser and are not stored. Input up to 5 MB and 200,000 cells is processed.