CSV to JSON & JSON to CSV Converter
Convert CSV to JSON and JSON to CSV online, both ways in one tool: headers as keys, numbers kept, nested JSON flattened, Excel-ready download. In your browser.
Options
Table
Enter CSV or JSON above to see it as a table here.
CSV to JSON & JSON to CSV Converter: A Quick Guide
Convert CSV to JSON and JSON to CSV in one place: paste or upload either one, and the other appears as you type. Headers become keys, numbers stay numbers, nested JSON becomes columns, and a table shows the result at a glance. Everything happens in your browser: nothing is sent anywhere or stored.
What are CSV and JSON?
CSV (comma-separated values) is a table as plain text: one row per line, the values separated by commas, and usually a first row of column names. Every spreadsheet program opens and saves it. JSON (JavaScript Object Notation) is the format of web APIs and configuration files: objects of named values, lists, numbers, true and false, which can nest inside each other. The same three people look like this in each:
name,age,member
Ann,30,true
Ben,25,false
"Smith, Cy",41,true
[
{ "name": "Ann", "age": 30, "member": true },
{ "name": "Ben", "age": 25, "member": false },
{ "name": "Smith, Cy", "age": 41, "member": true }
]
A value that contains the delimiter, a quote or a line break is wrapped in double quotes, and a quote inside it is written twice ("5"" screen").
How to use the converter
- To convert CSV to JSON, paste your CSV into the CSV field, or press Upload under it to open a file. The JSON appears in the JSON field as you type.
- To convert JSON to CSV, paste or upload JSON in the JSON field instead, and the CSV appears on the left.
- Check the Table below the options: it shows the data in rows and columns, so a wrong delimiter or a shifted column is easy to spot.
- Copy or Download the result. Changing an option converts again from the field you typed in last.
The options
- Delimiter: Auto-detect looks at the first lines and picks comma, semicolon, tab or pipe, and the status line says which. Choose one yourself if it guesses wrong. When converting JSON to CSV, Auto-detect writes commas.
- JSON indent: 2 or 4 spaces for readable JSON, or One line for the smallest file.
- First row is headers: on, each row becomes an object keyed by the column names; off, each row becomes a list of values, and JSON to CSV writes no header row.
- Numbers and true/false: on,
30becomes the number 30,trueandfalsebecome booleans andnullbecomes null; off, every value stays text. Only numbers written the way JSON writes them convert, so a zip code such as02134, a phone number with a+or a decimal comma such as3,50stays text, and so does a whole number too large to keep exactly (above 9007199254740991, where JavaScript's numbers stop being exact). An empty cell stays an empty string. - Nest dotted headers: on, a column named
address.citybecomes{"address": {"city": …}}, andtags.0,tags.1become a list. It reverses what JSON to CSV does with nested data.
How nested JSON becomes CSV
A table has no room for an object inside an object, so nested values are flattened into columns named by their path: {"address": {"city": "Oslo"}} gives a column address.city, and a list ["red", "blue"] under tags gives tags.0 and tags.1. The columns follow the order in which their keys first appear, so objects with different keys still line up, and a missing key leaves its cell empty, as does null.
The JSON can be a list of objects (the usual case), a list of lists, a list of plain values, a single object (one row), or an API response that wraps its list in one property, such as {"data": […]}, whose list is converted. JSON Lines, one object per line, works too.
When the CSV isn't perfect
- A row with fewer values than the header gets empty values; a row with more gets extra columns named
column6and so on. - An empty or repeated header is renamed (
column3,name_2), so no value is lost. - Blank lines are skipped, and Windows, Mac and Unix line endings all work. A quote that is never closed is the one real error: the field turns red and the message says on which line the quoted value starts.
Every adjustment is noted in the status line under the field you typed in.
Frequently asked questions
How do I open the CSV in Excel?
Download it and open the file. The download is UTF-8 with a byte order mark, which tells Excel that accents and other non-English letters are UTF-8, and has Windows line endings. If Excel puts everything in one column, your Excel expects semicolons, as it does in much of Europe: choose Semicolon as the delimiter and download again.
Can I convert a TSV file?
Yes. Tab-separated values are detected like any other delimiter, and with Tab chosen, JSON to CSV writes tabs and downloads a .tsv file. Data copied from a spreadsheet is tab-separated too, so you can paste cells straight into the CSV field.
How do I convert CSV to JSON in Python?
With the standard library: csv.DictReader reads each row as a dictionary keyed by the header, and json.dump writes the list.
import csv, json
with open("data.csv", newline="", encoding="utf-8-sig") as f:
rows = list(csv.DictReader(f))
with open("data.json", "w", encoding="utf-8") as f:
json.dump(rows, f, indent=2, ensure_ascii=False)
The other way, csv.DictWriter writes a list of flat dictionaries, given the header as its fieldnames. Python's csv module keeps every value as text, so numbers need converting yourself; pandas does both directions with read_csv() and to_json(orient="records"), and json_normalize() flattens nested JSON with dotted names, like this tool.
Is there a size limit?
Files up to 20 MB can be uploaded, and the table shows the first 100 rows. Since the conversion runs on your own computer, very large files depend on your browser's memory, and the result is always complete in the field.