CSV to JSON and JSON to CSV converter

Convert CSV to JSON and back: quotes, any separator, nested data.

Off by default: every value stays text, so nothing like 007 is changed.

What this tool does

It turns a table in CSV form into JSON, and JSON back into a table, without sending the data anywhere. A CSV file is just text with one record per line and a separator between values, which is easy to produce and surprisingly hard to read correctly: values can contain the separator itself, quotes, even line breaks. This converter follows the CSV specification (RFC 4180) and is forgiving about the untidy files that spreadsheets and exports really produce.

Converting CSV to JSON

  1. Paste the CSV, or open or drop a file.
  2. Leave "Separator" on automatic. The tool looks at the first rows and picks the comma, semicolon, tab or pipe that splits them into the same number of columns every time. Excel in many European and Vietnamese settings saves with semicolons, which is why guessing matters.
  3. Keep "First row is the header" ticked to get an array of objects keyed by column name, or untick it, or choose "Array of arrays", to get plain lists of values.
  4. Decide on conversion. By default every value stays text, exactly as written. Tick "Convert numbers, true/false and empty cells" and 42 becomes a number, true becomes a boolean and an empty cell becomes null. Numbers keep their exact text, so 1.50 stays 1.50.
  5. Copy the JSON or download it.

Converting JSON to CSV

Paste an array of objects, an array of arrays, or a single object. The columns are all the keys that appear in any record, in the order they first appear; a record that lacks a key gets an empty cell. Nested data is flattened by one documented rule: a key inside an object becomes the path joined with dots, so {"user": {"name": "An"}} gives a column called user.name, and array items are numbered, so tags becomes tags.0 and tags.1. If you prefer, keep a whole array as JSON text in one cell. Cells that contain the separator, a quote or a line break are quoted, with quotes doubled, as the standard requires.

A worked example

This CSV has a quoted value with a comma in it and an empty cell:

name,age,city
An,34,"Ha Noi, VN"
Binh,,Hue

With the defaults the result is a list of two objects in which every value is text, so Binh's age is an empty string. With conversion on, An's age becomes the number 34 and Binh's becomes null. In the other direction, the JSON {"id": 1, "user": {"name": "An"}, "tags": ["a", "b"]} becomes the columns id, user.name, tags.0 and tags.1, with the values 1, An, a and b.

Why conversion is off by default

Spreadsheets quietly turn text into numbers and damage data: a postcode 01234 loses its zero, a 16-digit card or order number turns into scientific notation, a product code like 1E5 becomes 100000. This tool does not guess unless you ask. Even with conversion on, a value with a leading zero, or an integer of more than 15 digits, stays text, because JavaScript cannot hold such numbers exactly.

Common mistakes

  • The wrong separator. Everything lands in one column. Leave the setting on automatic, or choose the separator by hand.
  • Accents look broken in Excel. Excel needs a byte order mark to recognise UTF-8. Tick "Add a byte order mark" when you convert to CSV for Excel.
  • A cell that starts with = + - or @. Excel treats it as a formula when you open the file. Check data from untrusted sources before opening it in a spreadsheet.
  • Unbalanced quotes. One stray quote can swallow the rest of the file. The tool warns you and tells you the line.

Limits

Input up to 5 million characters or 10 MB for a file. The result box shows the first 200,000 characters of very large results; copy and download always contain everything. Dates are not converted: they stay text.

Frequently asked questions

Is my data uploaded?

No. The conversion runs in your browser; the file is read on your device and nothing is sent anywhere.

How does it know the separator?

It splits the first rows with each candidate, comma, semicolon, tab and pipe, ignoring separators inside quotes, and picks the one that gives the same number of columns on the most rows. You can always choose one yourself.

How are nested JSON objects and arrays turned into columns?

Nested keys are joined with dots (address.city) and array items are numbered (tags.0, tags.1). Choose "Keep as JSON in one cell" to leave arrays unflattened.

Why is my number still in quotes?

Conversion is off by default, or the value is not a plain JSON number: it has a leading zero, a plus sign, thousands separators or more than 15 digits. Those stay text so nothing is altered.

Can it read a file saved by Excel?

Yes, as long as it was saved as CSV or text. A byte order mark at the start is removed, and line breaks inside quoted cells are kept.