JSON to CSV Converter (and CSV to JSON)

Turn an array of JSON objects into a CSV file for spreadsheets, or turn a CSV export back into JSON for code and APIs. Nested objects become columns such as address.city and can be rebuilt on the way back, every field is quoted correctly according to RFC 4180, and the delimiter is detected automatically, including the semicolons used by German and Spanish spreadsheets. A table preview shows the first 50 rows, and an optional byte-order mark makes Excel read accented characters correctly.

Convert

Input

422 characters

Output

CSV
id,name,email,address.city,address.country,active,notes
1,Ana López,ana@example.com,Madrid,ES,true,
2,Ben Carter,ben@example.com,Austin,US,false,
3,Clara Weiß,clara@example.com,Berlin,DE,,"Prefers ""email"", not phone"

Table preview (first 50 rows)

idnameemailaddress.cityaddress.countryactivenotes
1Ana Lópezana@example.comMadridEStrue
2Ben Carterben@example.comAustinUSfalse
3Clara Weißclara@example.comBerlinDEPrefers "email", not phone

Checks

  • Pass 3 rows × 7 columns.

Runs entirely in your browser. Nothing you paste or open here is uploaded or stored.

How to use the converter

  1. Choose the direction: JSON → CSV or CSV → JSON.
  2. Paste your data or press Sample.
  3. Pick a delimiter. For CSV input, Detect automatically usually gets it right.
  4. Set the options: flatten nested objects (JSON → CSV), or header row, type detection and rebuilding nesting (CSV → JSON).
  5. Check the table preview, then copy or download data.csv or data.json.

How the conversion works

JSON → CSV. The input should be an array of objects (a single object becomes one row, and an array of arrays is written as rows directly). Every object is flattened, and the columns are the union of all keys in order of first appearance, so objects with missing fields simply get empty cells. Each field is quoted only when needed: if it contains the delimiter, a double quote (doubled as ""), a line break, or leading or trailing spaces. Lines end with CRLF, as RFC 4180 specifies.

CSV → JSON. The parser handles quoted fields, escaped quotes and line breaks inside quotes, so addresses and notes spanning several lines stay in one field. The first row provides keys (or column1, column2… without a header). Rows with too few or too many fields are reported.

Worked examples

Example 1: exporting users for a spreadsheet

Load the JSON sample: three users with nested addresses. The CSV has the columns id, name, email, address.city, address.country, active, notes. The note containing quotes and a comma is wrapped in quotes with inner quotes doubled, exactly as Excel and Google Sheets expect.

Example 2: a German spreadsheet export

Paste a CSV that uses semicolons, such as Name;Stadt;Umsatz. Automatic detection picks the semicolon, and the JSON keys come from the header row. A check tells you which delimiter was detected.

Example 3: rebuilding nested data

Convert the CSV sample with rebuild nesting on. The columns address.city and address.country become "address": {"city": …, "country": …}, so the JSON matches the shape an API expects.

Choosing the right options

  • Keep type detection on for numbers and booleans, but turn it off when every value must stay text (product codes, phone numbers).
  • Turn flattening off only if your objects are already flat.
  • Add the BOM only for Excel; other tools don’t need it, and some command-line tools show it as a stray character.

Common mistakes

  • Pasting JSON Lines (one object per line, no brackets). Wrap the lines in [ ] and add commas first.
  • Opening a CSV by double-clicking in Excel when it uses a different delimiter from your region’s default. Use Excel’s import dialog, or export with the matching delimiter.
  • Leading zeros lost in spreadsheets. The CSV keeps them; it’s the spreadsheet that converts 02134 to a number. Import that column as text.
  • Inconsistent objects. Different keys in each object create many sparse columns. Normalise the data first.

Frequently asked questions

How are nested objects handled?

With flattening on, nested keys become dot-path columns: {"address": {"city": "Madrid"}} becomes a column named address.city. Converting back with “rebuild nesting” turns those columns into nested objects again. Arrays are written as JSON text inside the cell.

Why does Excel show strange characters like é?

Excel assumes older encodings for CSV files unless they start with a UTF-8 byte-order mark (BOM). Turn on “Add BOM so Excel reads UTF-8” and accents, ß, ñ and Cyrillic display correctly.

Why do some spreadsheets use semicolons?

In countries where the comma is the decimal separator, such as Germany and Spain, spreadsheet programs use semicolons between fields. Choose the semicolon delimiter for those users, or let the converter detect it when importing.

Are numbers converted automatically?

When converting CSV to JSON, values that look like plain numbers, true, false or null are converted. Values with leading zeros, such as ZIP codes like 02134, stay as text so nothing is lost.

Can I convert CSV back to JSON?

Yes. Switch the direction and paste CSV: the first row becomes the keys, and numbers and true/false values can be converted to real JSON types.

Sources