Skip to content

How do you turn JSON into CSV, or CSV into JSON?

Convert JSON to CSV and CSV to JSON, with nested data flattened to columns, right in your browser.

CSV

2 records, 4 columns

Writes the value b inside a as one column named a.b. Off writes nested values as JSON text.

Convert JSON to CSV and CSV to JSON, with nested data flattened to columns, right in your browser.

How to use

  1. Choose JSON to CSV or CSV to JSON, then paste your text.
  2. Read the converted text and copy it.
  3. Open the options below to flatten nested data, change the separator or say whether the first row is a header.

How it works

CSV is a table written as text: one record per line, fields separated by commas. A field that contains a comma, a double quote or a line break is wrapped in double quotes, and a quote inside it is doubled (RFC 4180). JSON is a tree of objects and arrays, so turning it into a table takes a rule for the nesting.

This tool uses the usual rule: each object in a list becomes a row, each key a column, and a nested value gets a column named by its path. An object with a name, a nested born.year and a list of tags has the columns name, born.year and tags.0. Keys missing from a row leave an empty cell. Going back, dotted headers rebuild the nesting, and a numeric step makes an array.

CSV has no types, so reading it back is a guess. With type detection on, 42 becomes a number, true and false become booleans and an empty cell becomes null; a value such as 007 is not a JSON number and stays text, and so do integers too large to be exact. Files from European spreadsheets often use a semicolon, which the tool detects. It writes only RFC 4180 commas.

Worked example

What does [{"name":"Ada","born":{"year":1815}}] become as CSV?

  1. Each object is one row, and the keys become the columns: name and born.year (the nested year is flattened).
  2. The first row lists the column names, then one line follows for each object.

The header is name,born.year and the row is Ada,1815.

Frequently asked questions

How is nested JSON turned into CSV?

Each nested value gets a column named by its path, such as address.city or tags.0. Switch the option off to write nested values as JSON text in one cell.

Can the JSON be a single object?

Yes. One object gives one row. A list of objects gives one row each.

Are leading zeros kept, as in a ZIP code?

Yes. A value such as 00501 is not a valid JSON number, so it stays text. Turn type detection off to keep every cell as text.

My CSV uses semicolons. Does that work?

Yes. The separator is detected from the first line, or you can choose it.

Is my data uploaded?

No. The conversion runs in your browser.

Send feedback