DataFormattools
JSON · Converter

JSON to CSV Converter

Convert JSON arrays and nested objects into CSV format online. Automatically flattens nested keys, generates headers, and exports RFC 4180 CSV.

Interactive Editor
JSON Input (Array of Objects)
0 lines · 0 B
1
Auto-executes on edit
CSV Output
0 lines · 0 B
1
100% In-Browser Privacy: All conversions, formatting, and validations run purely on your machine using client-side JavaScript. Your data, code snippets, and environment variables are never transmitted to any server or recorded in logs.
Specifications

How JSON → CSV Works

  • Scans all JSON array items to discover all unique column headers.
  • Flattens nested object properties into dot-notation column names (e.g. user.address.city).
  • Formats cell values according to RFC 4180, enclosing strings with commas in double quotes.
Demonstration

Example Input & Output

Extracts union of keys from all array objects to build the header row, flattening nested objects and escaping commas inside quotes.

JSON Input (Array of Objects)
[
  {
    "id": 1,
    "name": "Sandeep",
    "role": "Lead",
    "location": "Hyderabad, India"
  },
  {
    "id": 2,
    "name": "John Doe",
    "role": "Developer",
    "location": "London, UK"
  }
]
CSV Output
id,name,role,location
1,Sandeep,Lead,"Hyderabad, India"
2,John Doe,Developer,"London, UK"
Applications

Common Use Cases

Spreadsheet Export

Import JSON database queries into Excel, Google Sheets, or Numbers.

Analytics & Reporting

Convert API data dumps into CSV tables for Tableau or PowerBI ingestion.

Guidelines

Key Specifications & Gotchas

Non-Array Top Level

Top-level JSON should ideally be an array of objects to generate tabular rows.

Questions

Frequently Asked Questions

Can I convert nested JSON to CSV?

Yes, nested objects are automatically flattened into dot-notated column names.

How are commas inside values handled?

Values containing commas or line breaks are automatically wrapped in double quotes per RFC 4180.

Related JSON & Data Format Tools

View all 41 tools →