Skip to content
DeviceCheckHub

CSV to JSON Converter

Turn a CSV file or pasted spreadsheet data into JSON, or turn JSON into CSV. It finds the separator, handles quotes and line breaks inside cells, and shows how your CSV was read. It all happens in your browser.

Paste CSV or open a file and its JSON appears here. Nothing is uploaded.

How to convert CSV to JSON, and back

  1. Choose CSV to JSON to turn spreadsheet data into JSON, or JSON to CSV to go the other way.
  2. Paste your data into the left box, or press Open a file (or drag a file onto the box). A file can be up to 10 MB. The result updates as you type.
  3. Check the table under the boxes. It shows how your CSV was read, so a wrong separator or a shifted column is obvious before you copy anything.
  4. Press Copy result or Download. Use result as input flips the direction so you can check that a round trip returns what you started with.

What CSV and JSON are

CSV (comma-separated values) is a plain text table: one row per line, and the cells of a row separated by a comma or another separator. Spreadsheets, databases and many web services can export it. JSON is the format that programs and web services pass around: it holds text, numbers, true or false, null, lists and objects with named values, and the objects can contain other objects. Converting CSV to JSON gives every row a set of named values, usually using the first row as the names. Converting JSON to CSV does the opposite and has to squeeze possibly nested data into a flat table.

The CSV to JSON options

Quotes, line breaks and other awkward cells

A cell that contains the separator, a line break or a quotation mark has to be wrapped in double quotes, and a quote inside such a cell is written as two quotes. For example, "Likes ""tea"", not coffee" is the text Likes "tea", not coffee. The converter follows these rules, so a cell can hold commas and even several lines. A byte order mark at the start of the file, which some programs add, is ignored. If a quote is never closed, or text follows a closing quote, the page names the line where the problem is instead of producing wrong data.

Rows with a different number of cells than the header are still converted, and the page lists them: missing cells become null, and extra cells get names like “column 6”. Two columns with the same name get a number added to the later one, and an empty column name becomes “column 3” and so on, so that no value is lost.

JSON to CSV

The best input is a list of objects, each of which becomes a row. The columns are all the names found in any object, in the order they first appear, and an object that lacks a name gets an empty cell. A single object becomes one row, a list of lists becomes rows with numbered columns, and a list of plain values becomes one column called “value”. A mix of objects and plain values is reported as an error, because it cannot be a table.

Common problems

Your data stays on your device

Many converters upload the file to a server. This page does not: reading, converting and writing all run in your browser, so a customer list or a database export is never sent anywhere. Because such data is often personal, the page does not keep it either. Only your settings are remembered on this device, and a reload starts with empty boxes.

Frequently asked questions

Why did my zip code or ID keep its leading zeros as text?

On purpose. A value such as 00501 is a code, not a quantity, and writing it as the number 501 would lose the zeros for good. The converter only turns a cell into a JSON number when writing it back gives the same digits, so codes with leading zeros, phone numbers and very long ids (more than 15 digits) stay text. If you want everything as text, untick “Convert numbers and true/false”. If the zeros were already gone in the file you pasted, usually because a spreadsheet dropped them, they cannot be recovered here.

How is nested JSON written as CSV?

With “Flatten nested objects” ticked, an object inside an object becomes extra columns named with dots, so {"city": {"name": "Lisbon"}} gives a column called city.name. Lists inside an item, such as tags, are written into one cell as JSON text like ["a","b"], because a list has no fixed number of columns. Untick the option to keep every nested object as one cell of JSON text. Going the other way, tick “Nest columns named a.b” to rebuild the objects.

My CSV ends up in one column, or in the wrong columns. Why?

The file uses a different separator than the program that opened it expects. Many European spreadsheet settings write semicolons because the comma is their decimal mark, and some exports use tabs or pipes. Here, “Auto-detect” compares the first lines and picks the separator that gives the same number of columns on every line, and you can choose one by hand. When you write CSV, pick the separator the program that will open it expects.

What does “Protect against spreadsheet formulas” do?

A spreadsheet treats a cell that starts with =, +, - or @ as a formula, so a value such as =HYPERLINK(…) taken from untrusted data can run when someone opens the file. With the option on, text values that start with one of those characters get a ’ in front, which makes the spreadsheet show them as plain text. It changes those values, so leave it off when the file is for a program rather than a person, and turn it on when untrusted text will be opened in a spreadsheet. Real JSON numbers such as -5 are not changed.

Is my data uploaded?

No. Reading the CSV, converting it and writing the result all run in your browser, so nothing you paste or open is sent to this website or anywhere else. The page remembers only your settings on this device, not your data, because spreadsheets so often hold names, emails and other personal information.

How big a file can I convert?

Files up to 10 MB can be opened. The work happens on your own device, so the time depends on how fast it is, and a file near the limit takes a moment to convert. For larger files, convert the part you need, or use a command line tool.

Last updated · About DeviceCheckHub