SPARKPOND / GUIDE

How to Flatten Nested JSON into CSV

Nested object paths can become columns, while arrays need a selected tabular policy.

Problem symptoms

  • A spreadsheet shows [object Object].
  • Different records have different nested keys.

Why it happens

  • JSON is hierarchical and CSV is rectangular.
  • Arrays may contain scalars, objects or mixed values.

Example before and after

Before

{"id":1,"person":{"name":"Ada","city":"Paris"}}

After

id,person.name,person.city
1,Ada,Paris
Download example ↓

Procedure

  1. Inspect the union of object paths.
  2. Choose path notation.
  3. Select a policy for every nested array.
  4. Preview columns and missing fields, then export.
Convert JSON to CSV Online →

Common mistakes

  • Joining complex arrays with commas without preserving structure.
  • Using only the first record to define columns.

Other possible solutions

  • Keep NDJSON when hierarchy matters more than spreadsheet compatibility.

Important limitations

  • Some heterogeneous nested arrays cannot be represented losslessly in one CSV row.

Related guides

How to Preserve Leading Zeros in CSV Files

Leading zeros disappear when identifiers are interpreted as numbers rather than text.

How to Convert Excel XLSX to CSV Without Excel

A browser can read XLSX values locally and serialize each selected sheet as a separate CSV.