CSV to JSON and JSON to CSV Converter

Paste CSV on one side and get JSON on the other, or paste a JSON array and get CSV back. Delimiters are detected for you, quoted fields are handled, and it is free and runs entirely in your browser.

CSV to JSON and JSON to CSV ConverterPrivate · runs on your device
CSV
JSON
Type in either box. The other one updates as you type.

Example: name,age Ana,31 → [{"name":"Ana","age":31}]

How to use the CSV to JSON and JSON to CSV converter

There is no direction switch. The page has a CSV box and a JSON box, and whichever one you type in becomes the source for the other.

  1. Paste CSV into the CSV box to get JSON, or paste a JSON array into the JSON box to get CSV.
  2. Set CSV delimiter to Auto detect, Comma, Semicolon or Tab.
  3. For CSV to JSON, choose the JSON shape: Array of objects uses the first row as the keys, while Array of arrays keeps every row, header included, as a plain list.
  4. Leave Convert numbers ticked to turn values such as 31 into JSON numbers, or untick it to keep every value as text.
  5. Use Copy CSV, Copy JSON, Download .csv or Download .json. Clear both empties the two boxes.

A status line reports how many rows were parsed, counting the header row.

How the conversion works, with examples

Take this CSV, where one city contains a comma and is therefore wrapped in quotes:

name,age,city
Ana,31,Leeds
Ben,27,"York, UK"

With the default settings the JSON holds two objects, {"name": "Ana", "age": 31, "city": "Leeds"} and a second one for Ben whose city is York, UK. The output is indented with two spaces. A quoted field may contain the delimiter, line breaks and doubled quotes, so "Smith, ""Bob""" is read as Smith, "Bob".

Auto detect looks only at the first line: if it splits into more pieces on semicolons than on commas it picks the semicolon, and it picks the tab only when the text contains a tab and no comma anywhere. Otherwise it uses a comma.

Going the other way, the header is the union of every key, in the order each first appears. From [{"name":"Ana","age":31},{"name":"Ben","city":"Leeds, UK"}] you get name,age,city, then Ana,31, and Ben,,"Leeds, UK". Missing keys and null values become empty cells. Nested objects and arrays are written into the cell as JSON text, because CSV has no hierarchy. A single object is treated as a one-record list, and an array of arrays is written row by row.

Choosing Array of arrays for the same three-line CSV gives [["name","age","city"],["Ana",31,"Leeds"],["Ben",27,"York, UK"]], with the header kept as the first row. Both Windows and Unix line endings are understood when reading CSV.

Limits and common mistakes

Number conversion is deliberately simple. A value is converted when it is a whole or decimal number with an optional minus sign, so 007 becomes 7 and a long account number can lose digits, because JSON numbers in a browser hold about 15 significant digits. Untick Convert numbers for postcodes, phone numbers and identifiers. Words such as true and false stay as text, and values like 1e5 or +44 are not converted.

Other behaviours to know: a blank header becomes column1, column2 and so on; if two columns share a header the later one overwrites the earlier one; a short row gets empty strings; extra cells beyond the header are ignored in object mode. The parser is forgiving, so a stray quote usually changes the column layout rather than producing an error, which is a good reason to scan the output.

When writing CSV, a cell is quoted if it contains a comma, semicolon, tab, quote or line break. For tidy-up before converting, the duplicate line remover and whitespace remover help. To check or indent the JSON result, use the JSON formatter, and to embed a JSON snippet in code see the JSON stringify tool. Files are processed locally, so exports of customer data are not uploaded.

A typical workflow for a spreadsheet export is to save it as CSV, paste it into the CSV box, keep Array of objects, untick Convert numbers if there are identifier columns, and copy the JSON into your app or mock API. For the reverse, paste an array from an API response into the JSON box and download the .csv to open in a spreadsheet. If the JSON is invalid, the note under the boxes says "Invalid JSON" followed by the browser's message.

Quick answers

Frequently asked questions

The questions people ask most, answered in plain words.

How do I convert CSV to JSON without uploading my file?

Paste the CSV into the CSV box and the JSON appears in the other box straight away. The parsing is done by JavaScript in your browser, so the data is never sent to a server. Use Copy JSON or Download .json to keep the result.

Does the converter handle commas inside quoted fields?

Yes. A field wrapped in double quotes can contain commas, semicolons, line breaks and doubled quotes, and it is read as a single value. When you convert JSON back to CSV, any cell containing a delimiter, quote or line break is quoted again automatically.

What happens when JSON objects have different keys?

The CSV header is built from every key found in any object, in the order each key first appears. An object that lacks a key gets an empty cell in that column, so no data is dropped and every row has the same number of columns.

Can it read semicolon or tab separated files?

Yes. Auto detect picks a semicolon when the first line has more semicolons than commas, and a tab when the text has tabs but no commas. If the guess is wrong, choose Comma, Semicolon or Tab from the CSV delimiter list and the output updates.

Why did my leading zeros disappear?

Convert numbers is ticked by default, so a value such as 007 becomes the number 7. Untick Convert numbers and every value stays as text, which keeps leading zeros in postcodes, phone numbers and product codes. Check very long numbers too, as they can lose digits.