Tutorial · 5 min read

How to Convert Nested JSON to CSV in Excel

JSON APIs almost never return flat data. You get objects inside objects, arrays of nested items, and deeply buried fields. Before you can work with that data in Excel or Google Sheets, you need to flatten it into a clean CSV. This guide covers three flattening modes and how to use our JSON to CSV converter to get results in seconds.

The Problem with Nested JSON

A typical API response looks like this — easy to read in JSON, but impossible to paste directly into a spreadsheet:

[
  {
    "name": "Alice",
    "contact": {
      "email": "alice@example.com",
      "phone": "123-456-7890"
    },
    "address": {
      "city": "Beijing",
      "district": "Haidian"
    }
  },
  {
    "name": "Bob",
    "contact": {
      "email": "bob@example.com"
    },
    "address": {
      "city": "Shanghai",
      "district": "Pudong"
    }
  }
]

CSV only supports flat rows and columns. To convert this, you need to flatten the nested fields into separate columns — and that's exactly what a free JSON to CSV tool does automatically.

1. Dot-Separated Flattening (Default)

This is the most common mode. Nested keys become dot-separated column headers:

namecontact.emailcontact.phoneaddress.cityaddress.district
Alicealice@example.com123-456-7890BeijingHaidian
Bobbob@example.comShanghaiPudong

Best for: data analysis, database import, and spreadsheet work. Try it with the converter — it's the default mode and works out of the box.

2. JSON String Mode (Preserve Structure)

Sometimes you want to keep the nested structure intact. In this mode, nested objects are kept as JSON strings in a single cell:

namecontactaddress
Alice{"email":"alice@example.com","phone":"123-456-7890"}{"city":"Beijing","district":"Haidian"}
Bob{"email":"bob@example.com"}{"city":"Shanghai","district":"Pudong"}

Best for: when you need the original structure for reference, or when the nested data will be processed by another script later.

3. 1-Level Only Mode (Shallow Flatten)

A middle ground — flatten only the first level of nesting, keep deeper levels as JSON strings:

namecontactaddress.cityaddress.district
Alice{"email":"alice@example.com","phone":"..."}BeijingHaidian

Best for: when only the top-level nesting matters and deeper details can remain as JSON strings.

4. Handling API-Wrapped Responses

Most APIs wrap their data in an outer object with metadata. The actual array is buried inside:

{
  "status": "ok",
  "count": 2,
  "data": {
    "users": [
      { "id": 1, "name": "Alice" },
      { "id": 2, "name": "Bob" }
    ]
  }
}

Fix: Use the JSON Path feature in the tool. Simply enter data.users as the path, and the converter extracts that specific array for conversion.

Try the Free JSON to CSV Converter

Paste nested JSON and see it flattened instantly. Edit cells, choose output format, and download clean CSV.

Convert JSON to CSV Now →

Best Practices for JSON to CSV Conversion

Frequently Asked Questions

How do I convert nested JSON to CSV online?

Paste your nested JSON into the JSON to CSV Converter. The tool automatically flattens nested objects using dot notation (e.g., address.city). Choose between Dot-Separated, JSON String, or 1-Level mode in the configuration bar.

What is the best flattening mode for nested JSON?

Dot-Separated mode is the default and works for most cases. Use JSON String mode if you need to preserve the original structure. Use 1-Level mode when only the first nesting level matters. Experiment by switching modes — the table preview updates instantly so you can see the result before exporting.

How do I handle API-wrapped JSON responses?

API responses often wrap arrays in objects like {"data": {"items": [...]}}. Use the JSON Path input to specify the path, e.g., data.items. The tool will extract that specific array for conversion.

Can I edit the data before exporting to CSV?

Yes — the table preview is fully editable. Double-click any cell to modify its value. You can also sort columns, hide columns, insert or delete rows, and undo changes. All edits are included in the final CSV export.

Why is my CSV showing garbled text in Excel?

This happens when Excel misinterprets the character encoding. In the tool's config bar, switch encoding to UTF-8 BOM and line endings to CRLF. For best results, download as .xlsx format directly instead.

Is my JSON data safe with this converter?

100% safe. All processing happens in your browser. Your JSON data is never uploaded to any server, stored, or tracked. The tool works offline once loaded — your data never leaves your computer.