CSV to JSON Converter
Convert CSV to JSON and JSON to CSV, with a table preview.
About this tool
Paste CSV to get an array of JSON objects, or paste JSON to get CSV back. The delimiter is detected automatically (comma, semicolon, tab or pipe), quoted fields and line breaks inside quotes are handled, and nested JSON objects are flattened into dotted column names.
How to use it
- Paste CSV exported from a spreadsheet or database, or paste a JSON array of objects.
- The direction and the delimiter (comma, semicolon, tab or pipe) are detected automatically; override them if needed.
- For CSV, choose whether the first row is the header and whether numbers and true/false become typed values.
- Check the table preview, then copy the output.
Questions
- My Excel CSV uses semicolons. Will it work?
- Yes. Excel in many European locales saves CSV with semicolons, and the delimiter is detected from the data. You can also pick it manually.
- How are commas or line breaks inside a value handled?
- Values wrapped in double quotes may contain the delimiter and line breaks, and a doubled quote ("") inside them stands for one quote character, as defined in RFC 4180.
- What happens to nested objects when converting JSON to CSV?
- They are flattened into dotted column names, so {"address": {"city": "Oslo"}} becomes a column called address.city. Arrays are written as JSON text in a single cell.
- Are leading zeros and phone numbers kept?
- Yes. Only plain numbers become JSON numbers, so values like 00123, +48 600 100 200 or very long IDs stay text. Turn off Numbers and booleans to keep every value as text.
- Does it handle CSV files with Windows line endings?
- Yes. CRLF, LF and lone CR line endings are all accepted, so a CSV saved by Excel on Windows parses the same way as one produced by Linux tools. Line breaks inside quoted values stay part of the value. CSV generated from JSON uses LF line endings.
- Why does it say a quoted field is never closed?
- A value starts with a double quote, but no closing quote follows before the end of the input, so everything after it would become one field. Find the value that begins with " and add the missing closing quote, or remove the opening one if the value was never meant to be quoted.
- Can I convert TSV or copied spreadsheet cells to JSON?
- Yes. Copying a range of cells in Excel or Google Sheets puts tab-separated text on the clipboard, and the tab delimiter is detected automatically. Paste it into the input to get JSON without saving a file first. TSV exports from database clients work the same way.
How to convert CSV to JSON
CSV to JSON conversion turns every row into an object whose keys come from the header row. Under the header id,name,active, the line 1,Ada Lovelace,true becomes {"id": 1, "name": "Ada Lovelace", "active": true}. With Numbers and booleans on, plain numbers, true, false and null become typed JSON values. Turn it off to keep every value a string. The table preview shows the first 50 rows, so you can check the columns before copying.
When a CSV file has no header row, turn off First row is the header and the keys become column1, column2 and so on. The same names fill in for empty header cells. A row with fewer fields than the header gets empty strings for the missing columns, while extra fields beyond the header are dropped. A shifted column in the table preview usually means an unquoted value contains the delimiter.
CSV delimiters and Excel
CSV has no single delimiter. Excel uses the list separator from the regional settings, so in Germany, France, Poland and much of Europe, where the comma is the decimal separator, CSV files use semicolons. Database exports and Unix tools often produce tab-separated values (TSV), and some systems use a pipe. The converter tries comma, semicolon, tab and pipe and picks the one that gives the most consistent column count across the first rows.
JSON to CSV writes commas by default. Pick a semicolon if the file should open with a double click in a European Excel, or Tab to paste the result straight into spreadsheet cells. Values containing the delimiter, quotes or line breaks are wrapped in double quotes automatically. If accented letters look broken when Excel opens the downloaded file, import it with Data > From Text/CSV and choose UTF-8, because Excel may assume an older encoding.
How to convert a JSON array to CSV
JSON to CSV expects an array of objects, such as the items of an API response. Each object becomes a row, and the columns are the union of all keys in the order they first appear. An object missing a key gets an empty cell, and null also becomes an empty cell. A single object produces a one-row CSV, and an array of plain values like [1, 2, 3] produces one column called value.
Many APIs wrap the list in an envelope, as in {"data": [...], "page": 2}. Converting that directly gives a single row with the whole list packed into one cell as JSON text. Paste only the inner array instead, and open the response in JSON Formatter first if the structure is hard to see. When the CSV is headed for a database import, check the column names: dotted names like address.city may need renaming.
Something not working, or a result looks wrong? Report a problem with this tool