JSON and CSV converter

This JSON and CSV converter turns a JSON array of objects into a CSV table that you can open in Excel and other spreadsheet apps, and converts CSV text back to JSON, with a choice of delimiter and options for the header row, nested objects, and value types.
Input
To CSV: a JSON array of objects. To JSON: CSV text, for example from an Excel sheet. Up to 1 MB and 20,000 rows.

The conversion runs in the browser. Please enable JavaScript.

Everything runs in your browser; nothing is sent or stored.

  • Paste an array of objects or CSV text into the "JSON or CSV" field, and click "JSON to CSV" or "CSV to JSON". A nested object becomes columns with a dot in the name (address.city), and an array is written as JSON inside the cell. A null value becomes an empty cell.
  • In the "Delimiter" list, choose a comma, a semicolon, or a tab, or keep the "Detect automatically" option, which finds the delimiter in the CSV text.
  • In the "Options for conversion to JSON" section, choose whether the first row is a header row, whether to create nested objects, and whether to detect value types.
  • Below the result, the tool shows the number of rows, the number of columns, and the delimiter, and when converting to CSV, also a warning about cells that may be read as formulas.
  • Copy the result by clicking "Copy". For Excel to display accented letters and other non-ASCII characters correctly, save the file in UTF-8 with BOM encoding, or import it through Data, From Text/CSV, and choose UTF-8.

Converting JSON to a CSV table

Conversion to CSV works with an array of objects: each object becomes a row, and each key becomes a column. The header row includes every key that appears in the objects, in the order in which each key first appears, and when an object is missing a key, the matching cell in its row stays empty. A cell that contains the delimiter, a quote, or a line break is wrapped in quotes, and quotes inside the value are doubled, as defined in RFC 4180. This way, even free text with commas and line breaks stays in a single cell.

Converting CSV to JSON

When the "The first row is a header row" option is selected, each row becomes an object, and the key names come from the header row. Without a header row, each row becomes an array of values. With the nested objects option, a column name with a dot, such as address.city, becomes a nested object, so converting a table that was created from JSON back to JSON restores the nested structure. Without value type detection, every cell is kept as text. When the type detection option is selected, a value becomes a number only when it is written exactly the way JSON writes that number, so a postal code or a phone number that starts with 0 stays text and keeps its leading zero.

Cells that start with a formula character

Excel and other spreadsheet apps read a cell that starts with =, +, -, or @ as a formula. When the data comes from forms or other user input, an attacker can enter a formula that displays a misleading link, sends data from the sheet to an outside server, or tries to run commands on the computer that opens the file. This attack is called CSV injection or formula injection. Before you open a file built from user input in Excel, check the cells that start with formula characters. You can add an apostrophe (') at the start of a value so that the cell is shown as text.

Cell values and their types when converting to JSON

  • 42becomes the number 42.
  • 007stays text, and the leading zeros are kept.
  • 1.50stays text, because JSON writes this number as 1.5.
  • TRUEbecomes the value true, regardless of letter case.
  • nullbecomes the value null, only when it is written in lowercase letters.
  • [1,2]a cell that contains a valid JSON array becomes an array.
  • 12345678901234567890stays text, because the number is too long to be stored exactly as a JSON number.

JSON and CSV converter FAQ

Why does Excel show all the data in one column?

Excel splits a CSV file into columns by the list separator set in the regional settings of the operating system. In regional settings where the comma is used as the decimal separator, the list separator is usually a semicolon. In that case, choose "Semicolon (;)" in the "Delimiter" list and convert again, or import the file through the Data tab and choose the delimiter during the import.

Why do accented letters and other non-English characters look garbled in Excel?

Excel does not always detect that a CSV file is saved in UTF-8 encoding, and then it decodes the text with a different encoding. Save the result in a text editor with UTF-8 with BOM encoding, which adds a mark at the start of the file that identifies the encoding, or import the file through the Data tab, using the From Text/CSV option, and choose UTF-8.

Why do I get an error about the number of fields on a line?

When converting with a header row, every line must have the same number of fields as the header row. The error is usually caused by a value that contains the delimiter and is not wrapped in quotes, such as an address with a comma. The message shows the line number, the number of fields found on that line, and the number of fields in the header row.

Can I convert a single JSON object?

Yes. A single JSON object is converted to a table with one row. An array that contains an item that is not an object, such as a number, is not converted, and the message shows the position of the first item that is not an object.

What happens to empty or duplicate column names?

When converting to JSON, a column without a name gets a name based on its position, such as column_2, and a duplicate name gets a number suffix, such as name_2, so that every key in the object has a unique name. The number of renamed columns is shown below the result.

What is the maximum size of a JSON or CSV file to convert?

The input can be up to 1 MB and include up to 20,000 data rows, and the table can include up to 1,000 columns. When converting to CSV, the result can include up to 2,000,000 cells, and a nested JSON structure is converted up to a depth of 100 levels.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement