Paste your JSON below to convert it to CSV format:

Loading...

How JSON to CSV Conversion Works

This tool converts JSON arrays into CSV (Comma-Separated Values) format. Each object in the array becomes a row, and each property becomes a column. It's the fastest way to get JSON data into Excel, Google Sheets, or any spreadsheet application.

What JSON Structure Works Best?

The ideal input is an array of flat objects:

[
  { "name": "Alice", "email": "alice@example.com", "age": 30 },
  { "name": "Bob", "email": "bob@example.com", "age": 25 }
]

Or an object containing an array:

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

Handling Nested Objects

When your JSON contains nested objects or arrays, they're converted to JSON strings in the CSV output. For example:

{ "name": "Alice", "address": { "city": "NYC", "zip": "10001" } }

Becomes:

name,address
Alice,"{""city"":""NYC"",""zip"":""10001""}"

Delimiter Options

OptionUse Case
, CommaStandard CSV, works everywhere
; SemicolonEuropean locales where comma is decimal separator
TabTSV format, good for data with commas
| PipeWhen data contains commas and quotes

Common Use Cases

  • API response to spreadsheet โ€” Export API data for analysis in Excel
  • Database export โ€” Convert MongoDB/JSON exports to CSV for reporting
  • Data migration โ€” Move data between systems that expect different formats
  • Quick data review โ€” CSV is easier to scan than nested JSON

Programmatic Conversion

JavaScript

function jsonToCsv(jsonArray) {
  if (!jsonArray.length) return '';
  
  const headers = Object.keys(jsonArray[0]);
  const rows = jsonArray.map(obj => 
    headers.map(h => JSON.stringify(obj[h] ?? '')).join(',')
  );
  
  return [headers.join(','), ...rows].join('\n');
}

Python

import json
import csv
import io

def json_to_csv(json_data):
    output = io.StringIO()
    writer = csv.DictWriter(output, fieldnames=json_data[0].keys())
    writer.writeheader()
    writer.writerows(json_data)
    return output.getvalue()

Pro Tips

  • ๐Ÿ’ก Flatten first โ€” For deeply nested JSON, consider using our JSON Flatten tool before converting
  • ๐Ÿ’ก Check encoding โ€” If you see garbled characters, ensure your JSON is UTF-8 encoded
  • ๐Ÿ’ก Large files โ€” This tool handles files up to a few MB. For larger datasets, use a programmatic approach

Related Tools