Home › JSON to CSV Converter

JSON to CSV Converter Online

Convert JSON arrays to CSV files instantly. Free, private, runs in your browser — no signup, no data sent to servers.

Convert JSON to CSV →

How to Convert JSON to CSV

  1. Click "Convert JSON to CSV" above to open the tool
  2. Paste your JSON array into the left panel
  3. Choose delimiter: comma (,), semicolon (;), or tab
  4. Click Convert — CSV appears in the right panel
  5. Click Download CSV or copy to clipboard

JSON Input Format

The converter expects a JSON array of objects. Each object becomes a CSV row:

[
  { "name": "Alice", "age": 30, "city": "New York" },
  { "name": "Bob",   "age": 25, "city": "London"   },
  { "name": "Carol", "age": 35, "city": "Tokyo"     }
]

Output CSV:

name,age,city
Alice,30,New York
Bob,25,London
Carol,35,Tokyo

Handling Nested Objects

Nested objects are flattened using dot notation:

[
  {
    "name": "Alice",
    "address": { "city": "New York", "country": "USA" }
  }
]

Becomes:

name,address.city,address.country
Alice,New York,USA

JSON to CSV in JavaScript

Need to convert JSON to CSV programmatically? Here is a simple function:

function jsonToCSV(data, delimiter = ',') {
  if (!data.length) return '';
  const headers = Object.keys(data[0]);
  const escape = val => {
    const str = String(val ?? '');
    return str.includes(delimiter) || str.includes('"') || str.includes('\n')
      ? `"${str.replace(/"/g, '""')}"` : str;
  };
  const rows = data.map(row => headers.map(h => escape(row[h])).join(delimiter));
  return [headers.join(delimiter), ...rows].join('\n');
}

const csv = jsonToCSV([
  { name: 'Alice', age: 30 },
  { name: 'Bob', age: 25 }
]);
// name,age
// Alice,30
// Bob,25

JSON to CSV in Python

import json, csv, io

def json_to_csv(json_data):
    data = json.loads(json_data) if isinstance(json_data, str) else json_data
    output = io.StringIO()
    writer = csv.DictWriter(output, fieldnames=data[0].keys())
    writer.writeheader()
    writer.writerows(data)
    return output.getvalue()

json_str = '[{"name":"Alice","age":30},{"name":"Bob","age":25}]'
print(json_to_csv(json_str))

Delimiter Guide

Delimiter Use When
Comma (,)Standard CSV — works with Excel (US), Google Sheets, Python csv module
Semicolon (;)European Excel versions (which use comma as decimal separator)
Tab (\t)TSV format — best when data contains commas (e.g. addresses)
Pipe (|)When data contains commas and semicolons

Frequently Asked Questions

How do I convert JSON to CSV?+
Paste your JSON array into the converter and click Convert. The tool flattens the JSON into tabular rows, using the first object's keys as column headers. Each object in the array becomes a row. Download the result as a .csv file or copy to clipboard.
What JSON structure works best for CSV conversion?+
A flat array of objects works best: [{"id":1,"name":"Alice"},{"id":2,"name":"Bob"}]. Nested objects can be flattened (e.g., address.city becomes a column). Arrays within objects are serialized as JSON strings in the CSV cell.
Can I open the CSV in Excel or Google Sheets?+
Yes. The generated CSV uses standard comma-separated format compatible with Excel, Google Sheets, LibreOffice Calc, and any spreadsheet tool. For Excel on Windows with special characters, use the 'Text Import Wizard' to correctly handle UTF-8 encoding.
Does JSON to CSV handle nested objects?+
The tool flattens nested objects using dot notation for column names: a field {"user":{"name":"Alice"}} becomes column user.name. For deeply nested structures, consider using the JSON Flatten tool first.
What if objects in my JSON array have different fields?+
The converter uses a union of all keys across all objects as column headers. For objects missing a particular field, the corresponding CSV cell is left empty. This handles heterogeneous arrays cleanly.
Can I convert CSV back to JSON?+
Yes. Use the CSV to JSON converter to go in the other direction. Paste or upload a CSV file and the tool converts each row back to a JSON object, using the header row as keys.

Convert JSON to CSV now

Free, private, instant. Your data never leaves your browser.

Open JSON to CSV →

Also useful: JSON to YAML | JSON to XML | JSON Formatter | JSON Diff