EN FR

How to Flatten Nested JSON — Convert Complex API Data into Clean CSV / Excel in Seconds

Published on April 28, 2026 by the DevToolbox Team — 7 min read

Almost every API returns nested JSON. You request a list of users, and inside each user there’s an address object with street, city, zip; maybe a preferences object, or an array of orders. Spreadsheets and databases, on the other hand, expect flat tables. The gap between the two is where flattening nested JSON becomes essential.

Whether you need to convert a JSON array to CSV, export json to excel online, or turn a raw API response into a formatted CSV that Excel can read with proper accents, this guide will show you the fastest, most private way to do it — without writing a single line of code.

What does “flatten nested JSON” actually mean?

It means taking a structure like this:

[
  {
    "name": "Alice",
    "address": {
      "city": "Paris",
      "zip": "75001"
    }
  }
]

And turning it into a flat table:

name,address.city,address.zip
Alice,Paris,75001

The address sub‑object disappears; its fields become new columns with dot‑notation headers. That’s json to excel online 101, and it’s exactly what our JSON to CSV Converter does automatically when you check the Flatten objects option.

Why flatten JSON? Real‑world reasons

  • Convert API JSON to CSV for business reports. Your backend sends nested data; your stakeholder wants a table.
  • Prepare data for databases. Most SQL tools import flat CSV better than deeply nested JSON.
  • Debug JWT tokens. Often a JWT payload contains nested claims. You can decode the JWT, then flatten its payload into CSV for analysis.
  • Share with non‑tech colleagues. They know Excel, not JSON paths.

Common Uses for Flattening JSON

  • Export API responses to Excel
  • Import JSON into SQL databases
  • Analyze JSON data in spreadsheets
  • Create CSV reports from APIs
  • Prepare JSON for BI tools

Flatten nested JSON online — step by step with our free converter

Our nested JSON csv converter requires no upload, no login, and no server communication. Everything stays in your browser. Here’s the workflow:

1. Paste your JSON

Go to the JSON / CSV Converter and paste your raw JSON into the left panel. If you fetched it from an API, paste the whole response — the tool can extract the array for you.

2. Specify the array path (if needed)

APIs often wrap the actual array inside data, results, or users. Use the Array path field to point directly to the list you want to convert. For example, if your response looks like:

{
  "status": "ok",
  "data": {
    "users": [ ... ]
  }
}

Just type data.users. The converter will skip the wrapping layers and work on the array.

3. Enable flatten objects

Check the Flatten objects checkbox. This triggers the flattening of every nested object into dot‑notation columns. You can see the result immediately in the live table preview.

4. Convert and download

Click Convert to CSV →. The generated CSV appears in the right panel. For json csv excel utf8 compatibility, hit Download CSV (UTF‑8 BOM) — this adds the invisible marker that tells Excel to display French accents, umlauts, and any special characters correctly.

Going the other way: CSV to formatted JSON

If you have a flat CSV and want to reconstruct a nicely indented formatted JSON, the reverse path is just as simple:

  1. Paste your CSV into the right panel.
  2. Choose the delimiter (comma, semicolon, tab, pipe) — the tool auto‑detects if you’re unsure.
  3. Specify whether the first row contains column headers.
  4. Handle empty cells: treat them as empty strings, null, or 0.
  5. Click ← Convert to JSON. The result is a beautified JSON array, ready to be used in your code.

Why use our tool over writing a script?

Sure, you could write a Python or JavaScript function to flatten JSON. But every time the schema changes, you have to update the code. A visual converter with a live preview lets you adjust on the fly: toggle flattening, change the array path, or switch the delimiter without touching any code. Plus, it runs locally — no sensitive data ever leaves your machine.

Integrating with the rest of DevToolbox

Once you’ve flattened your JSON into CSV, you might need:

  • JSON Formatter — validate and pretty‑print your original JSON before flattening.
  • JWT Decoder — if your JSON contains a JWT token, decode it first to expose nested claims.
  • Password & Hash Generator — secure any credentials you extract from the JSON.
  • Regex Tester — clean up data fields before or after conversion.

Frequently Asked Questions

How can I flatten nested JSON online without uploading my data?

Use our free JSON to CSV converter. It runs entirely in your browser — paste your JSON, check “Flatten objects”, and download the CSV. No data is sent to any server.

Can I convert an API JSON response with nested objects into Excel?

Yes. Paste the API response, specify the array path if needed, enable flattening, then download as CSV with UTF‑8 BOM for perfect Excel compatibility.

What if my JSON array is buried inside data.users?

Use the Array path field to enter data.users (or any dot‑notation path), and the converter will extract and flatten only that array.

Does flattening work for deeply nested objects (3+ levels)?

Yes, the flattener recursively descends into sub‑objects and concatenates keys with a dot. There’s no limit on depth.

🔧 Try the Free JSON to CSV Converter