How to convert
- Choose the direction: CSV → JSON or JSON → CSV.
- Paste your data, or press Open a file… to load a .csv, .tsv, .txt or .json file. Opening a .json file switches to JSON → CSV automatically.
- For CSV input, leave the delimiter on Detect automatically unless you know better, and say whether the first row holds column names. Switch off Convert numbers and true/false if every value should stay text.
- Press Convert. A status line reports how many records and columns were found and which delimiter was used, and the table preview lets you check that columns lined up.
- Copy the result or download it as data.json or data.csv.
If accented letters or Chinese characters come out garbled after opening a file, change File encoding — spreadsheets saved by older software are often not UTF-8.
How CSV is parsed and written
CSV is described by RFC 4180. Each line is a record; fields are separated by commas; a field that contains a comma, a double quote or a line break must be wrapped in double quotes, and a double quote inside such a field is written twice. So the field he said "hi" is stored as "he said ""hi""". The parser here reads the text character by character and follows those rules exactly, which is why a line break inside a quoted address does not split the record.
Variations the parser accepts
- Delimiters. Excel in much of Europe writes semicolons, because the comma is the decimal separator there. Tab-separated and pipe-separated files are also common. Automatic detection counts each candidate outside quoted fields in the first 20 lines and picks the one that appears the same number of times on every line.
- Byte-order mark. Files saved as "CSV UTF-8" by Excel start with three invisible bytes (EF BB BF). They are removed so they do not end up inside the first column name.
- Line endings. Windows (CRLF), Unix (LF) and old Mac (CR) line breaks are all recognised. Empty lines between records are skipped.
- Encodings. When you open a file, it is first decoded as strict UTF-8. If that fails, it is decoded as Windows-1252, the usual encoding of spreadsheets saved by older Western software. You can also pick GBK or Shift_JIS by hand.
From text to JSON types
CSV has no types: every field is text. With Convert numbers and true/false on, a field becomes a JSON number if it is written like one, and true or false become booleans. Two cases deliberately stay text, because converting them would change the data: numbers with leading zeros, such as 007 or a ZIP code like 02134, and integers too large to be stored exactly in JavaScript (over 9,007,199,254,740,991), such as long account numbers.
From JSON to CSV
JSON can be nested; CSV cannot. Nested objects are flattened into dotted column names — {"a": {"b": 1}} becomes a column called a.b — and arrays are written into a single cell as JSON text. The columns are the union of every key found in the input, in the order they first appear, so records with missing fields get empty cells rather than shifting everything left. Output always uses CRLF line endings, as RFC 4180 specifies, and quotes only the fields that need it.
Examples
This CSV has a comma inside a quoted field, a doubled quote and a line ending of CRLF:
a,b
"x, y","he said ""hi"""It parses into two fields per row: x, y and he said "hi".
With type conversion on, n,v followed by the rows x,1, y,true and z, becomes:
[
{ "n": "x", "v": 1 },
{ "n": "y", "v": true },
{ "n": "z", "v": "" }
]A column containing 007 stays "007", and 12345678901234567890 stays a string, while 1.50 becomes 1.5 and -2e3 becomes -2000. Duplicate or blank header cells are renamed so no data is lost: the header a,a, produces the keys a, a_2 and column_3.
Going the other way, the JSON [{"a":1,"b":"x,y"},{"a":2,"c":"z"}] becomes:
a,b,c
1,"x,y",
2,,zand [{"a":{"b":1,"c":{"d":2}},"e":[1,2]}] becomes the columns a.b, a.c.d and e, with the row 1,2,"[1,2]".
Limits
- Flattening is one-way. Converting CSV back to JSON does not rebuild nested objects from dotted column names; you get flat keys such as "a.b".
- Spreadsheet formulas. A CSV cell beginning with =, +, - or @ may be treated as a formula when the file is opened in a spreadsheet. If the data comes from untrusted users, review it before opening the CSV in Excel.
- Dates stay as written. CSV has no date type, and this tool does not guess one. 03/04/2025 means different days in the US and in Europe, so it is left as text for you to interpret.
- Encoding detection is a best guess. A file that happens to be valid UTF-8 but was meant as another encoding cannot be told apart automatically. Choose the encoding by hand if the result looks wrong.
- Size. Hundreds of thousands of rows convert in about a second on a laptop; the preview shows only the first 200 rows so the page stays responsive.
Frequently asked questions
Why does my CSV open with garbled characters in Excel?
Excel assumes an older regional encoding unless the file starts with a byte-order mark. Keep Add BOM switched on when converting JSON to CSV and Excel will read UTF-8 correctly, including accented letters and Chinese text.
My CSV uses semicolons. Will it work?
Yes. Semicolon-separated files, common from European versions of Excel, are detected automatically. You can also choose the delimiter by hand.
Why is 007 still a string after conversion?
Converting it to the number 7 would lose information. Values with leading zeros are usually identifiers, product codes or postcodes, so they are kept as text.
How are nested JSON objects handled?
They are flattened into columns with dotted names, such as address.city. Arrays are written into one cell as JSON text.
Is my file uploaded?
No. The file is read and converted in your browser, and the result is created on your device.