How to Convert JSON to CSV, and What Happens to Nested Data

How a JSON array of objects maps to CSV rows and columns, what to do about nested objects, arrays and missing keys, and how to open the result correctly in Excel or Google Sheets.

By Utkarsh Garg · 2026-11-03 · 4 min read

How JSON maps to CSV

CSV is a flat table. JSON can be flat or deeply nested. The conversion works cleanly when your JSON is an array of objects that share the same keys. Each object becomes one row, and each key becomes a column. The keys of the first object become the header line.

For example, [{"name":"John","age":30},{"name":"Jane","age":25}] becomes a header line of name,age followed by one row for each person.

Using the converter

Paste a JSON array of objects into the JSON to CSV converter and press Convert. Every value is wrapped in double quotes, and any double quote inside a value is doubled, which is the standard CSV rule. This means values that contain commas or quotes stay in one cell instead of splitting into two.

The input must be a valid JSON array. If you paste a single object, wrap it in square brackets. If you get an invalid JSON message, run it through a JSON validator first, because a trailing comma or single quotes are the usual cause.

Nested objects and arrays

A table has no place for a value that is itself an object or a list. This converter does not flatten nested data, so a nested value is written as plain text rather than split into columns. If your data has nested parts, flatten it first so that each value sits at the top level.

A common approach is to join keys with a dot. An object like {"user":{"city":"Delhi"}} becomes a single key user.city with the value Delhi. For a list inside a row, either join its items into one cell, for example with a semicolon, or create one row per item.

Different keys in different objects

The header line comes from the first object only. If a later object has a key that the first one does not, that key will not get a column and its value is left out. If a later object is missing a key, its cell is left empty.

Before converting, make sure the first object contains every key you need, or add the missing keys with empty values. Sorting your data so that the most complete record comes first also works.

Opening the CSV in Excel or Google Sheets

Save the output in a file with the .csv extension and open it, or paste it into a sheet and use the split text to columns option. A few things are worth knowing.

  • Excel may turn long numbers such as phone numbers or IDs into scientific notation and drop leading zeros. Import the column as text to keep it exact.
  • Dates can be reinterpreted in the local format. Use the ISO form 2026-11-03 to avoid mix-ups.
  • In some regions Excel expects a semicolon rather than a comma. If everything lands in one column, use the import wizard and choose the comma as the separator.
  • For non-English text, save the file as UTF-8 so accented letters and other scripts display correctly.

When CSV is the wrong choice

If your data is deeply nested or each record has a different shape, CSV will lose information. In that case keep it as JSON, or split it into several related tables. CSV is best for flat, uniform records that you want to open in a spreadsheet, load into a database or share with someone who does not use JSON.