Conversion tool

JSON to CSV Converter (and CSV to JSON)

Convert JSON to CSV and CSV to JSON online. Nested objects flatten to columns, pick comma, semicolon or tab, and get a .csv for Excel. Nothing is uploaded.

Last updated

Paste a JSON array and get CSV back, or paste CSV and get JSON. It converts as you type, runs in your browser, and uploads nothing.

Convert
Delimiter

2 rows converted to CSV. Nothing here leaves your browser.

Preview, 2 rows

Preview of the converted table: 7 columns, 2 rows shown
nameageindooraddress.cityaddress.postcodetoysfavourite_spot
Miso3trueLeedsLS1 4AP["mouse","box"]
Tofu5Yorksofa, left cushion

Type or paste in the first box and the CSV updates as you go, with a preview table underneath that shows the first 50 rows the way a spreadsheet would. Pick the delimiter that suits where the data is going, then press Copy CSV or .csv to save a file. Press CSV → JSON or Swap to go the other way. Everything runs in your browser and nothing is uploaded.

How JSON becomes a table

CSV is a grid: a header row, then one row per record, every row with the same columns. JSON can be shaped any way at all, so a converter has to decide how to fit one into the other. This one works like this:

In the JSONIn the CSVWhy
An array of objectsOne row per objectEach object is a record
A single objectOne rowSo a lone record still converts
A key in any objectA columnColumns are every key that appears, in the order first seen
A key missing from one objectAn empty cellThe column still exists for the other rows
"address": {"city": "Leeds"}A column address.cityNested objects flatten to dot paths
"toys": ["mouse", "box"]["mouse","box"] in one cellA list has no fixed number of columns
nullAn empty cellCSV has no null
90071992547409939007199254740993Every digit kept, even past what a JavaScript number holds

Keys keep the order they were written in. A converter that goes through a JavaScript object moves keys that look like numbers, such as "2" and "10", to the front of every row. This one does not.

Commas, quotes and line breaks

CSV has no official standard, but RFC 4180 is the one most tools follow, and this converter follows it both ways:

  • A value holding the delimiter, a double quote or a line break is wrapped in double quotes: sofa, left cushion becomes "sofa, left cushion".
  • A double quote inside a quoted value is written twice: say "hi" becomes "say ""hi""".
  • Rows end with a carriage return and line feed (CRLF), which every spreadsheet reads.

Reading CSV, a quoted cell may hold commas, quotes and even several lines. A quote that is opened and never closed is reported with the line and column where it starts, since everything after it would otherwise be swallowed into one cell.

JSON to Excel

Excel opens CSV files directly, so the quickest route from JSON to a spreadsheet is to convert here and press .csv. Two things trip people up:

  • Accented letters and emoji turn into garbage. Excel guesses the text encoding of a CSV and often guesses wrong. The downloaded file starts with a UTF-8 byte order mark, an invisible marker that makes Excel read it as UTF-8.
  • Everything lands in column A. In countries where the decimal separator is a comma, Excel expects semicolons between columns. Pick Semicolon before downloading.

For pasting rather than saving, pick Tab and copy: tab-separated text pastes into Excel and Google Sheets as separate columns.

One caution for data from other people: a cell that starts with =, +, - or @ may be run as a formula when the file is opened in a spreadsheet. The tool warns you when it sees one, and leaves the value as it is.

CSV to JSON

The first row is the header, and each row after it becomes an object with those keys. Blank lines are skipped, and a byte order mark at the start of the file, which Excel adds when it saves "CSV UTF-8", is dropped rather than stuck to the first column name.

Real CSV files are rarely tidy, so the awkward cases are handled rather than refused, with a note under the output each time:

  • A header row and nothing else gives an empty array, [].
  • A row with fewer cells than the header gets null for the missing values, so you can tell a missing cell from an empty one ("").
  • A row with more cells than the header keeps the extras under keys named after their position, column_4, column_5, rather than dropping them.
  • A blank or repeated column name is renamed (column_2, name_2) so no value overwrites another.

Values that are plainly numbers, such as 3 and 1.5, become JSON numbers, and true and false become booleans. Anything else stays a string, including numbers with a leading zero (0123), so ZIP codes, phone numbers and IDs keep their zeros. Dot-path columns such as address.city stay as flat keys.

  • JSON Formatter and Validator, to pretty-print or check JSON before converting it, or to tidy the JSON you get back.
  • JSON to YAML Converter, for turning the same data into a config file instead of a table.
  • SQL Formatter, for the query that exported the CSV in the first place.
  • The SQL cheat sheet, for SELECT, JOIN and GROUP BY once the data is in a database, and the Python cheat sheet, whose csv and json modules do this conversion in a script.
  • Merge sort, visualised: a stable sort, the kind that keeps rows with equal values in their original order when you sort a table by one column.

Common questions

How do I convert JSON to CSV online?

Paste a JSON array of objects into the box at the top of this page. The CSV appears next to it as you type, with a preview table of the first 50 rows underneath. Press Copy CSV to take it, or the .csv button to save it as a file. The conversion runs in your browser, so the JSON is never uploaded. The site records that the tool was used and how long the input was, never the data itself.

How do I convert CSV to JSON?

Press CSV to JSON above the boxes, or press Swap to flip the direction and carry the current output across as the new input. Paste your CSV and you get a JSON array with one object per row, keyed by the header row. Plain numbers and true or false become JSON numbers and booleans; everything else, including numbers with a leading zero such as ZIP codes, stays a string.

How do I open JSON in Excel?

Convert it to CSV here and press the .csv button, then open the file in Excel. The downloaded file starts with a UTF-8 byte order mark, which is what tells Excel to read accented letters and emoji correctly. If your Excel uses a comma as the decimal separator, as it does in much of Europe, pick Semicolon first, because that version of Excel expects semicolons between columns.

What happens to nested objects and arrays?

A nested object is flattened into one column per value, named by its path, so an address object with a city becomes a column called address.city. An array is written into its cell as compact JSON, such as ["mouse","box"], because a list of any length does not fit a fixed set of columns. Converting the CSV back gives those as strings, not nested JSON.

What if my objects have different keys?

The columns are every key that appears in any object, in the order they are first seen, so nothing is dropped. A row that lacks a key gets an empty cell in that column. Converting CSV to JSON works the other way: a row with fewer cells than the header gets null for the missing values, and a row with more cells keeps the extras under keys named column_4, column_5 and so on.

How are commas, quotes and line breaks in values handled?

By the rules in RFC 4180, the closest thing CSV has to a standard. A value holding the delimiter, a double quote or a line break is wrapped in double quotes, and any double quote inside it is doubled, so say "hi" becomes "say ""hi""". Reading CSV follows the same rules, so a quoted cell can hold commas and even run over several lines.

Can I use a semicolon or tab instead of a comma?

Yes. Pick Comma, Semicolon or Tab above the boxes. The choice sets what separates the columns in the CSV you get, and what the tool splits on when reading CSV. Tab-separated output pastes straight into Excel or Google Sheets as columns. If a CSV you paste comes out as a single column, the tool checks the header for another delimiter and tells you which one to pick.

See all tools

Want this explained by a cat?

The videos cover the same ground in sixty seconds. If there is a tool you want built next, ask.