Developer Tools4 min read7 March 2026

How to Convert JSON to CSV: A Developer's Complete Guide

Step-by-step guide to converting JSON data to CSV format — handling nested objects, arrays, custom delimiters, and exporting for Excel or data analysis.

When to Convert JSON to CSV

JSON is the king of API data exchange, but CSV is the king of spreadsheets and data analysis. You'll typically need to convert JSON to CSV when:

  • Sharing API data with non-technical stakeholders in Excel or Google Sheets
  • Importing data into analytics tools like Tableau, Power BI, or Looker Studio
  • Seeding a database with flat tabular data
  • Processing data with command-line tools like csvkit or awk

JSON Array Structure Required

To convert cleanly to CSV, your JSON should be an array of objects with consistent keys:

[
  {"id": 1, "name": "Alice", "email": "alice@example.com"},
  {"id": 2, "name": "Bob", "email": "bob@example.com"}
]

This produces a CSV with columns id, name, email and two data rows.

Handling Nested Objects

Most real API responses contain nested objects. These need to be "flattened" for CSV — nested keys are typically joined with a separator:

// Input
{"user": {"name": "Alice", "age": 30}, "score": 95}

// Flattened CSV column names
user.name, user.age, score

Our JSON to CSV converter handles this automatically.

Handling Arrays in Values

Arrays within objects are trickier — they can't represent naturally in flat CSV. Common approaches:

  • Stringify — join array values as a delimited string: "apple,banana,cherry"
  • Expand rows — one row per array element (increases row count)
  • Drop the field — if the array data isn't needed

CSV Delimiters

CSV files use different delimiters depending on locale and application:

  • Comma (,) — the default, widely supported
  • Semicolon (;) — common in European locales where commas are decimal separators
  • Tab ( ) — TSV format; useful when data contains commas
  • Pipe (|) — used in some database exports

Using the ToolsPal JSON to CSV Converter

  1. Paste your JSON array into the input panel
  2. Select your preferred delimiter (comma, semicolon, tab, or pipe)
  3. The CSV output is generated instantly with a header row
  4. Click the Download .csv button to save the file directly
  5. Row and column counts are shown so you can verify the conversion

Free Online Tool

Try JSON to CSV

Convert JSON arrays to CSV spreadsheet format instantly.

Open Tool →