This CSV to JSON converter turns rows copied from a spreadsheet, database export or analytics report into a JSON array that an API or a script can read. It also converts JSON back into CSV. Both directions run as JavaScript in your browser, so the data you paste is not uploaded.
How to convert CSV to JSON
- Leave the mode switch on CSV → JSON and paste your data into the Input CSV box. There is no file picker, so open a .csv file in a text editor and copy its contents, or press Try Example to load a sample.
- Pick the Delimiter your data uses: Comma, Semicolon, Tab or Pipe. Spreadsheet programs set to a language that writes decimals with a comma often save CSV files with semicolons.
- Keep First row is header ticked if the first line holds column names, and choose Array of Objects or Array of Arrays under JSON format.
- Leave Prettify output on for JSON indented with 2 spaces, or turn it off to get everything on one line.
- Click Convert. The status line reports how many rows and columns were converted, and the Copy button copies the result. There is no download button, so paste the JSON into a file if you need one.
What the options and type detection do
With a header row and Array of Objects, each data row becomes an object whose keys are the column names. Array of Arrays keeps every row as a plain list, and with the header ticked the header row stays in as the first list. Unticking First row is header always produces arrays, because objects need names for their keys.
Values are typed as they are converted. A field made only of digits, with an optional minus sign and decimal part, becomes a JSON number if it is shorter than 16 characters. The words true, false and null become JSON literals, and everything else stays a string. An empty field becomes an empty string, a row with fewer fields than the header gets null for each missing column, and fields beyond the last header column are dropped.
Quoted fields can hold the delimiter, line breaks and doubled quotes, so "Smith, John" stays one value. Spaces are not trimmed: with the header name, age and the row Jane, 28, the key becomes " age" and the value " 28", stored as text.
Example: a product list
Paste this CSV with the default settings:
sku,name,price,in_stock,zip
A-100,"Desk lamp, brass",24.50,true,02134
B-220,Notebook,3,false,The status line reports 2 rows × 5 columns, and the output is:
[
{
"sku": "A-100",
"name": "Desk lamp, brass",
"price": 24.5,
"in_stock": true,
"zip": 2134
},
{
"sku": "B-220",
"name": "Notebook",
"price": 3,
"in_stock": false,
"zip": ""
}
]Two values changed on the way. The price 24.50 became the number 24.5, which is the same value in JSON. The ZIP code 02134 became 2134, because the converter turns any short run of digits into a number and drops the leading zero, even when the field is in quotes. ZIP codes, phone numbers, account numbers and product codes that start with 0 are affected, so check those columns and put the values back as strings before you use the JSON.
Converting JSON to CSV
Click JSON → CSV and paste an array of objects or an array of arrays. For objects, the header row lists every key found anywhere in the array, in the order the keys first appear, and an object that lacks a key gets an empty cell. Null becomes an empty cell, nested objects and arrays are written into the cell as JSON text, and any value containing the delimiter, a quote or a line break is wrapped in quotes. Untick Include header row to leave the header line out.
[{"id":1,"tags":["a","b"],"meta":{"x":1},"note":null},{"id":2,"extra":"yes"}]becomes
id,tags,meta,note,extra
1,"[""a"",""b""]","{""x"":1}",,
2,,,,yesThe input has to be an array. A single object such as {"id":1} stops with the message "JSON must be an array. Got object." Wrap it in square brackets to convert it as one row.
CSV to JSON in Python, for files with leading zeros
If you need to keep leading zeros, or the file is too large to paste comfortably, convert it with a script. Python's standard library does it in a few lines, and csv.DictReader keeps every value as a string, so 02134 stays "02134", 24.50 stays "24.50" and true stays "true".
import csv, json
with open("products.csv", newline="") as f:
rows = list(csv.DictReader(f))
print(json.dumps(rows, indent=2))For a quick job the page is faster: paste, convert, then open the result in the JSON formatter to browse it as a tree or to validate an edited copy. The text diff checker helps when you need to compare two exports of the same table. JSON vs CSV: which format to use and when explains which format suits which job, and the other converters and formatters are listed under developer tools.