How the flattening works
Your JSON is typically an array of records. For each record, we walk every key. Scalar values become cells; nested objects are prefixed with the parent key using dot notation; arrays of primitives are joined with a pipe; arrays of objects are expanded with their index. Concretely:
{
"id": 42,
"name": "Mary",
"address": { "city": "London", "country": "UK" },
"tags": ["admin", "editor"]
}becomes:
id,name,address.city,address.country,tags
42,Mary,London,UK,admin|editorUse cases
- Spreadsheet analysis: exporting an API response into Excel or Google Sheets.
- Database import: converting a JSON dump into a CSV for
COPYinto Postgres or MySQL. - BI dashboards: feeding tools that prefer flat tables over nested records.
- Audit trails: keeping a human-readable archive of API payloads.
Edge cases
- Missing keys: if some records don't include a key, its cell is left empty.
- Null values: written as empty cells.
- Mixed shapes: the CSV header is the union of all keys found across records.
- Non-array root: a root object is treated as a single row.
Next steps
Once the CSV is downloaded, open it directly in the CSV viewer to sanity-check the rows and column order before sending it to Excel, Postgres, or a BI tool. And if you later need to move the same data back into an API payload, convert it back to JSON here — the flattening is a round-trip once you know the dot-notation convention.
FAQ
- How do I convert JSON to CSV?
- Paste or upload your JSON — typically an array of objects — pick the CSV delimiter, and copy or download the result.
- What happens to nested objects?
- Nested objects are flattened using dot notation in the column header. For example, {"address": {"city": "Paris"}} becomes a column "address.city".
- What about arrays inside values?
- Arrays of primitives are joined with a pipe character (|) into a single cell. Arrays of objects are flattened with their index (e.g. tags.0, tags.1).
- Which delimiter should I pick?
- Comma is the default and most widely supported. Pick semicolon if your CSV will be opened in Excel on a French, German or Dutch locale. Pick tab if any of your values might contain commas or semicolons.
- Can I convert a single JSON object?
- Yes — a root object is treated as a one-row CSV. A root array is treated as a multi-row CSV.