JSON To CSV

Convert JSON to CSV. Free JSON to CSV converter.

A list of objects, a single object, an object that holds the rows (such as {"data": [...]}), or JSON Lines (one object per line).

Rate this tool

How useful was this tool?

JSON to CSV Converter

Paste JSON into the box, choose a delimiter and the other options, and click Convert to CSV. A preview shows the first rows, how many rows and columns there are, and notes on how the tool read your data, such as which list it used as the rows. Copy the result, or download it as a .csv file. There’s also an Excel-friendly version of the download.

Your JSON stays on the page. It isn’t uploaded or stored.

Example

Here’s a typical API response. The rows are wrapped in a data key, the second object lists its keys in a different order, some keys appear in only one object, and some values are nested:

{
  "data": [
    {
      "id": 9007199254740993,
      "name": "Maria Silva",
      "active": true,
      "price": 19.90,
      "address": { "city": "Porto", "zip": "4000-322" },
      "tags": ["admin", "beta"]
    },
    {
      "name": "John "JJ" Smith",
      "id": 2,
      "active": false,
      "price": 5,
      "address": { "city": "Boston", "zip": "02134" },
      "note": "Paid, thanks"
    }
  ]
}

With nested values as their own columns, the CSV is:

id,name,active,price,address.city,address.zip,tags.0,tags.1,note
9007199254740993,Maria Silva,true,19.90,Porto,4000-322,admin,beta,
2,"John ""JJ"" Smith",false,5,Boston,02134,,,"Paid, thanks"

What happened:

  • The data wrapper was skipped. The rows inside it became the CSV rows.
  • Every value is in the right column. The second object lists name before id, but each value still lands under its own heading.
  • Missing keys leave empty cells. The second row has no tags, and the first has no note.
  • Nested values got their own columns. address.city and address.zip come from the object, and tags.0 and tags.1 from the list.
  • Special characters are escaped. The quotes in John "JJ" Smith are doubled, and both that name and Paid, thanks are wrapped in quotes, so a reader doesn’t mistake the comma for a column break.
  • Numbers are kept exactly as written. This is less obvious than it sounds. Most converters run the JSON through JavaScript first, which turns 9007199254740993 into 9007199254740992 and 19.90 into 19.9. JavaScript numbers can’t hold whole numbers above 9,007,199,254,740,991 exactly, so long IDs from databases and APIs get silently changed. This tool copies the digits as they appear.

JSON it accepts

  • A list of objects: [{...}, {...}]. Each object becomes a row. This is the usual case.
  • A single object: {...}. It becomes one row.
  • An object wrapping the rows, like {"data": [...]}, which many APIs return. The tool finds the list inside.
  • A plain list of values: ["a", "b", "c"]. It becomes a single column.
  • JSON Lines: one object per line, with no surrounding brackets. Log files and data exports often use this format.

Nested data: separate columns or JSON text

Nested values as their own columns gives you a flat table that’s easy to sort and filter in a spreadsheet. Objects become address.city, address.zip, and list items become tags.0, tags.1, and so on.

Turn it off to keep each nested value as JSON text in a single cell:

tags,address
"[""admin"",""beta""]","{""city"":""Porto"",""zip"":""4000-322""}"

That’s harder to read, but it keeps the table narrow. Use it when lists are long or vary a lot between rows. An order with 40 line items, flattened, adds dozens of columns, mostly empty. JSON text is also the better choice when the CSV will be read by another program rather than a person.

Delimiter, quotes and header

Delimiter.

  • Comma is the standard.
  • Semicolon is what Excel expects in many European countries, where the comma is the decimal separator.
  • Tab produces a TSV file, which pastes straight into spreadsheets and copes well with text full of commas.
  • Pipe (|) is used by some databases and older systems.

Quote character. Values containing the delimiter, a quote or a line break are wrapped in quotes, and any quote inside the value is doubled. Double quotes are the standard. Choose single quotes only if the program reading the file asks for them.

Header row. Leave it on, unless you’re adding rows to the end of an existing file that already has headings.

Opening the CSV in Excel

A CSV is plain text, so Excel guesses what each value is, and it doesn’t always guess right:

  • Accented letters look garbled, for example “é” instead of “é.” Excel didn’t recognize the file as UTF-8. Use the Excel-friendly download.
  • Everything ends up in column A. Your Excel expects a different separator. Convert again with Semicolon.
  • Leading zeros disappear. Excel turns the ZIP code 02134 into 2134.
  • Long numbers change. Excel keeps only 15 significant digits, so 9007199254740993 displays as 9.0072E+15 and is stored as 9007199254740990.

To keep leading zeros and long numbers intact, don’t double-click the file. In Excel, open it through Data > From Text/CSV and set those columns to Text. In Google Sheets, use File > Import and untick the option that converts text to numbers.

One caution: Excel may treat a value starting with =, +, - or @ as a formula. If the JSON came from a source you don’t trust, check those cells before opening the file.

When the JSON isn’t valid

The tool tells you what’s wrong and where. The usual causes:

  • A comma after the last item: {"a": 1,}
  • Single quotes instead of double quotes: {'a': 1}
  • Keys without quotes: {a: 1}. This usually means a JavaScript object was copied from code rather than real JSON.
  • Comments (// or /* */). JSON doesn’t allow them.
  • Curly “smart” quotes, which creep in when JSON is pasted through Word, Google Docs or a chat app.
  • undefined or NaN, which aren’t valid JSON values.
  • Several JSON documents pasted one after another. Put each object on its own line to make it JSON Lines.

To find and fix problems in a larger file, use the JSON Validator. To make it readable first, use the JSON Beautifier.

FAQ

Can I convert CSV back to JSON?

Yes, with CSV to JSON.

Why are some cells empty?

That row’s object doesn’t have that key. The column exists because at least one other row does.

Why do my numbers look different in Excel?

The CSV has them exactly as written. Excel changes them when it opens the file. See “Opening the CSV in Excel” above.

Can I convert to other formats?

Yes: JSON to TSV, JSON to XML and JSON to YAML.

Is my data stored anywhere?

No. Everything stays on the page, and nothing you paste is stored.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us