How to Convert JSON to CSV

Learn array-of-objects shape, header detection, nested key flattening, delimiters, and a clean workflow to export JSON into spreadsheet-ready CSV.

By Generatr Team

JSON is great for APIs and apps: nested objects, arrays, mixed types. CSV is great for spreadsheets and many bulk imports: one header row, then flat rows of fields. Converting JSON to CSV means choosing a tabular shape — usually one row per object in an array — and deciding how nested fields become column names.

This guide covers the array-of-objects pattern, header detection, nested flattening, delimiter choice, and edge cases that break naive exports. When you want the conversion done in one paste, open the free JSON to CSV converter.

Going the other direction? Use the free CSV to JSON converter and our CSV to JSON guide for header and delimiter issues on the way back.

Free tool

Use the JSON to CSV Converter now

Open the interactive json to csv converter in your browser — free, instant, no signup.

Open JSON to CSV Converter

What JSON Shape Converts Cleanly to CSV?

The sweet spot is an array of objects with similar keys:

[
  {"name": "Ada", "age": 36, "city": "London"},
  {"name": "Lin", "age": 29, "city": "Taipei"}
]

Each object becomes one CSV row. Keys become column headers. Values become cells.

Shapes that need extra thought

  • Single object — treat as one-row table, or wrap as [{...}]
  • Array of primitives[1,2,3] is not a natural multi-column table; you may export one column
  • Deeply nested trees — need flattening rules or multiple tables
  • Mixed keys per row — union of all keys becomes the header set; missing cells stay empty

If your payload is invalid or minified into unreadability, pretty-print and validate first with the free JSON formatter and validator and our JSON formatter guide.

Wrapped API responses are common: {"data":{"items":[...]},"page":1}. Converting the outer object yields messy single-cell nests. Extract data.items (or whatever array holds rows) so each element becomes one CSV line. Five seconds of path picking saves an hour of spreadsheet cleanup.

How Are CSV Headers Taken From JSON Keys?

Most converters scan objects and build a header list from property names. Common strategies:

  • Keys of the first object only — fast, but drops columns that appear only later
  • Union of all keys across rows — safer for real API data with optional fields
  • User-specified column order — best when a spreadsheet template is fixed

Example with optional fields

Row 1: name, email. Row 2: name, email, phone. A first-object-only header set misses phone. Union headers yield:

name,email,phone
Ada,ada@example.com,
Lin,lin@example.com,555-0100

Empty cells are normal. They are not the same as the string "null" unless you choose to serialize nulls that way.

Key naming

Prefer stable, spreadsheet-friendly names before export when you control the API mapping: first_name beats awkward characters. You can rename columns after import, but clean keys save a cleanup pass.

How Do You Flatten Nested JSON Into CSV Columns?

CSV has no native nesting. Nested objects become extra columns, often with dotted or underscored paths:

{"id": 1, "user": {"name": "Ada", "meta": {"role": "admin"}}}

Flattened headers might be:

id,user.name,user.meta.role
1,Ada,admin

Arrays inside objects

Arrays are harder. Options include:

  • JSON-string cell — keep [1,2,3] as a single quoted field (lossy for analysis, fine for transport)
  • Join to a string1|2|3 with a secondary delimiter
  • One row per array item — normalize into long form (more rows, repeated parent fields)
  • Fixed max columnstag1,tag2,tag3 when length is bounded

There is no single right answer. Spreadsheet analysis usually wants long form or fixed columns; re-import to a system that understands JSON may prefer a stringified cell.

Converters that advertise nested flattening typically auto-build dotted keys for objects and apply a simple rule for arrays — read the output headers once before you trust a 10,000-row dump.

Depth limits matter. Flattening five levels of nesting can produce dozens of sparse columns where most rows are blank. Sometimes two CSVs (parents and children linked by an id) model the data better than one ultra-wide sheet. Choose the shape your next tool — pivot table, database import, or human review — actually needs.

Which Delimiter and Quoting Rules Should You Use?

Comma is the default for “CSV,” but not the only option.

DelimiterWhen it helps
Comma ,Excel/Google Sheets default in many locales
Semicolon ;Locales where comma is the decimal separator
TabTSV — fewer collisions with prose fields
Pipe |Data that is full of commas

Quoting

Fields that contain the delimiter, quotes, or newlines must be wrapped in double quotes, with internal quotes doubled ("""). A good converter does this for you. Never hand-split CSV on commas if fields can contain commas.

Types become text

JSON numbers, booleans, and null become cell text on the way to CSV. Spreadsheets may re-interpret 00123 as a number and drop leading zeros, or turn true into a boolean. For IDs and zip codes, force text on import or prefix carefully.

If you received JSON as a Base64 blob from an API, decode first with the free Base64 encoder/decoder — see also our Base64 guide — then convert the resulting JSON text to CSV.

What Is a Reliable JSON-to-CSV Workflow?

Use a short checklist so large exports do not surprise you mid-analysis.

  1. Validate JSON — fix trailing commas, single quotes, and truncated payloads.
  2. Confirm top-level array — extract data.results if the API wraps records.
  3. Inspect 2–3 sample objects — note nested keys and optional fields.
  4. Convert with union headers + flatten — review the header row.
  5. Pick delimiter for your locale and target app.
  6. Open a sample in a spreadsheet — check dates, IDs, and multiline fields.
  7. Only then export full volume to file or clipboard.

Round-trip caution

JSON → CSV → JSON rarely restores perfect nesting, types, and key order. Treat CSV as a presentation or bulk-edit layer, not a lossless archive of the original document tree.

How Do You Use an Online JSON to CSV Converter?

Paste valid JSON, choose delimiter and flattening options if offered, then copy or download CSV.

  1. Open the free JSON to CSV converter.
  2. Paste an array of objects (or format/validate first if paste fails).
  3. Confirm headers look complete for optional fields.
  4. Select comma, semicolon, tab, or pipe as needed.
  5. Enable nested flattening if objects contain sub-objects.
  6. Preview rows before exporting large files.
  7. Copy CSV or download for Excel, Sheets, or a database import tool.

Privacy note

Prefer client-side tools for personal or proprietary records so payloads are not uploaded to a server you do not control. Generatr’s converter is designed to run in the browser for that reason.

What Are Common JSON to CSV Mistakes?

Most failures are shape and quoting problems, not “CSV being hard.”

  • Feeding a nested API envelope without extracting the records array
  • Assuming first-object keys are complete when later rows add fields
  • Ignoring nested objects until columns show [object Object]
  • Wrong delimiter for the locale so Excel smashes everything into column A
  • Broken quoting when fields contain commas or line breaks
  • Silent type changes on spreadsheet import (leading zeros, dates, booleans)

This guide is educational. Validate critical exports against a known sample before bulk migrations or financial imports.

Step-by-Step Instructions

  1. 1Open the free JSON to CSV converter on Generatr.
  2. 2Validate or format your JSON if it is minified or possibly invalid.
  3. 3Use an array of similar objects as the input shape when possible.
  4. 4Paste the JSON into the converter.
  5. 5Review auto-detected headers and nested flattened column names.
  6. 6Choose a delimiter that matches your spreadsheet locale and data.
  7. 7Preview a few rows for missing fields and quoting issues.
  8. 8Copy or download the CSV for Excel, Sheets, or your import tool.

Frequently Asked Questions

How do you convert JSON to CSV?+

Start with an array of objects, map object keys to CSV headers, write one row per object with values in column order, and quote fields that contain delimiters or newlines. Online converters automate header detection and flattening.

What JSON format works best for CSV export?+

An array of flat (or lightly nested) objects with consistent keys. Deep trees and mixed arrays need explicit flattening or normalization rules before they become a clean table.

How are nested JSON fields handled in CSV?+

Typically by flattening into dotted or path-style column names (for example user.address.city). Arrays may be stringified, joined, expanded into multiple rows, or split into fixed columns.

Why does Excel put my whole CSV in one column?+

Often a delimiter mismatch — many European Excel setups expect semicolons. Try semicolon or tab, or use the text-import wizard and set the separator explicitly.

Is JSON to CSV conversion lossless?+

Usually not for nested structures and data types. CSV is a flat text table; round-trips can lose nesting, types, and key order. Keep the original JSON when structure matters.

Is Generatr’s JSON to CSV converter free?+

Yes. It runs in your browser with header detection, delimiter options, nested flattening, and copy/download — no account required.

Ready to try it yourself?

Use the free JSON to CSV Converter — no download, no account.

Launch JSON to CSV Converter