Skip to content
JSON Tidy
JSON Tidy / Tools

Convert nested JSON to CSV for Excel

Start with an array of records. Each record becomes a spreadsheet row, and fields inside nested objects become separate columns. This example shows exactly what happens to addresses, arrays, and identifiers.

Try this example in the converter

The link loads the sample below. Choose Convert to CSV, review the columns, then download. Conversion runs in your browser.

1. Start with the records array

[
  {
    "id": 9007199254740993,
    "name": "Maya",
    "address": {"city": "Boston", "postalCode": "02108"},
    "tags": ["customer","newsletter"]
  },
  {
    "id": 9007199254740994,
    "name": "Alex",
    "address": {"city": "London", "postalCode": "SW1A 1AA"},
    "tags": [],
    "active": true
  }
]

The two objects produce two rows. If your API returns a wrapper such as {"results":[…],"total":2}, copy the actual array inside results. The converter does not automatically select a property from a wrapper object.

Keep postal codes and other identifiers with leading zeros as JSON strings, like "02108". An unquoted number such as 02108 is not valid JSON.

2. Review the flattened columns

/id/name/address/city/address/postalCode/tags/active
9007199254740993MayaBoston02108["customer","newsletter"]—
9007199254740994AlexLondonSW1A 1AA[]true

The dash marks an empty cell in this illustration; it is not written into the CSV. /address/city and /address/postalCode come from the nested address. Headers use JSON Pointer paths: a slash inside a key is escaped as ~1, and a tilde as ~0.

The tags array stays as JSON text in one cell; it does not create extra rows. To make one row per tag or line item, reshape those records first. The /active column exists because Alex has that field; Maya’s cell is empty.

Deselect any columns you do not need before downloading. Null, missing fields, and empty strings all export as empty cells, so CSV cannot preserve their distinctions. Empty objects and arrays remain JSON text.

See the exact CSV text
"/id","/name","/address/city","/address/postalCode","/tags","/active"
"9007199254740993","Maya","Boston","02108","[""customer"",""newsletter""]",""
"9007199254740994","Alex","London","SW1A 1AA","[]","true"

Double quotes inside a cell are doubled for CSV. The download also includes a UTF-8 byte-order mark and uses CRLF line endings.

3. Import IDs and postal codes as Text in Excel

The converter retains the digits in 9007199254740993. Excel can change them when it interprets that cell as a number. Quoting a CSV field alone does not force Excel to treat it as text.

  1. In Excel, use Data → From Text/CSV and choose the downloaded file. Confirm the delimiter is a comma.
  2. Choose Transform Data. Set /id and /address/postalCode to Text before loading. If Power Query added an automatic Changed Type step, remove or edit that step before converting these columns to Text.
  3. Load the table and check that Maya’s ID is 9007199254740993 and the postal code is 02108. If either changed, reimport the original CSV; formatting an already-rounded number cannot restore its digits.

Menu names vary by Excel version. Microsoft documents preserving leading zeros and large numbers during import.

Before exporting your own data

Apostrophe protection is enabled by default for formula-like values, including negative numbers. It deliberately changes those cells. This example contains none; for your own file, review the option and imported result. Protection does not prevent Excel from interpreting long IDs as numbers.

Use a nonempty array of objects, no larger than 2 MB, with at most 10,000 rows, 200 columns, and 500,000 selected output cells. Duplicate keys are rejected. Need help with syntax? Validate or repair your JSON first.

Open the example and choose your columns