FC

📊 JSON to CSV Converter

Convert JSON arrays to CSV - auto-detects headers, handles nested values, supports custom delimiters

3 rows - 3 columns: name, age, email
name,age,email
Alice,28,alice@example.com
Bob,35,bob@company.org
Carol,42,carol@email.net

How to Use the JSON to CSV Converter

Paste a JSON array of objects into the left panel. The first object's keys become the CSV header row. Every subsequent object becomes a data row. Values containing commas or quotes are automatically wrapped in double-quotes per RFC 4180 standard. Click Download to save as a .csv file you can open directly in Excel or Google Sheets.

JSON Input

[{"name":"Alice","age":28}]

CSV Output

name,age
Alice,28
What JSON structures convert cleanly to CSV?

CSV is tabular — flat arrays of uniform objects convert perfectly. [{"name":"Alice","age":30},{"name":"Bob","age":25}] becomes a clean two-column CSV. Problems arise with: nested objects (how to represent {"address":{"city":"London"}} in flat CSV?), arrays of arrays (no natural column mapping), mixed schemas (objects with different key sets), and values containing commas or newlines. For nested data, the converter flattens with dot notation: address.city becomes a column header.

How are arrays within JSON objects handled in CSV conversion?

Arrays within objects cannot be represented in standard CSV. Options: serialize the array as a JSON string in one cell, expand each array element to its own row (duplicates parent data), or use a delimiter within a cell (pipe-separated). This converter defaults to serializing nested arrays as JSON strings. For arrays of primitives, this produces readable output. For arrays of objects, the JSON string in the cell is dense but preservable.

What encoding is used for CSV output and why does it matter?

This converter outputs UTF-8 encoded CSV. For Excel compatibility: UTF-8 CSV without BOM is sometimes not recognized by older Excel on Windows, causing non-ASCII characters to appear garbled. Adding a UTF-8 BOM (0xEF 0xBB 0xBF) signals UTF-8 to Excel. This tool generates CSV with BOM for Excel compatibility. If you see three strange characters at the start of your CSV in a text editor, that is the BOM — intentional for Excel.

How do I handle null values in JSON when converting to CSV?

JSON null maps to an empty cell in CSV. The distinction between null and empty string is lost in standard CSV — both appear as empty cells. If preserving null/empty distinction matters, output a sentinel string like NULL or \N (MySQL convention) and handle it in your database import. When importing into PostgreSQL with COPY, the default null string is empty — use COPY ... WITH (NULL 'NULL') if you used a sentinel value.

How do I import JSON-to-CSV output into PostgreSQL?

Save the CSV, then: COPY tablename (column1, column2) FROM '/path/file.csv' WITH (FORMAT CSV, HEADER true, DELIMITER ',', ENCODING 'UTF8'). For UTF-8 with BOM: PostgreSQL 16+ handles BOM automatically. For large files (millions of rows), COPY is orders of magnitude faster than individual INSERT statements. Map JSON field names to PostgreSQL column names in the column list — order must match CSV column order.

What other data conversion tools are on this site?

The CSV to JSON tool converts in the reverse direction. The JSON Formatter validates JSON before conversion. The JSON Schema Generator creates a validation schema for your source JSON. The XML to JSON tool handles XML data sources that need to become CSV via JSON. The Diff Checker verifies CSV output matches expected structure. All are in the Dev Tools section.

Complete Guide

📊 Key Data Points

Auto headers

Scans all objects to detect every unique key — no manual column configuration

Dot notation

Nested objects flatten to parent.child column names automatically

RFC 4180

Output follows the CSV standard — quoted fields, escaped commas

JSON to CSV Converter -- Complete USA Guide 2026

REST APIs return JSON. Spreadsheet users and data analysts want CSV. Manually writing a JSON-to-CSV export loop means handling nested objects, missing keys, and array fields differently every time.

This converter flattens JSON arrays into CSV with automatic header detection. Runs in your browser.

**Long-tail searches answered here:** convert JSON array to CSV online without installing anything, flatten nested JSON to spreadsheet columns, JSON to Excel CSV export browser tool free.

For the reverse operation, use CSV to JSON.

🔬 How This Calculator Works

Expects a JSON array of objects. Auto-detects all unique keys across all objects and uses them as CSV column headers. Nested objects are dot-notation flattened by default: user.name becomes a column. Arrays within objects are serialized as JSON strings in the cell. Missing values default to empty strings.

✅ What You Can Calculate

Auto-detects all column headers

Scans every object in the array for unique keys — handles sparse JSON where different objects have different fields without losing any columns.

Nested object flattening

Dot-notation flattening converts nested address.city to a column, making nested API responses spreadsheet-friendly.

Handles sparse data

When some records have fields others do not, missing values become empty cells rather than crashing or misaligning columns.

Download as .csv

One-click download saves as a properly formatted CSV file ready to open in Excel, Google Sheets, or import into a database.

🎯 Real Scenarios & Use Cases

Exporting API data for stakeholders

Your analytics API returns JSON but your manager wants a spreadsheet. Convert the response here in seconds instead of writing a custom export script.

Creating database seed files

You generated fake data as JSON. Convert to CSV for bulk import into MySQL using LOAD DATA INFILE.

Debugging flat API responses

The quickest way to spot inconsistencies in a 500-row JSON array is to open it in Excel. Convert here, download, and use spreadsheet filters to find anomalies.

Building test data for ETL pipelines

ETL tools often accept CSV as a source format. Convert sample JSON API responses here to create realistic test inputs.

💡 Pro Tips for Accurate Results

Format your JSON first. Paste your JSON into JSON Formatter to validate it before converting. A single syntax error in a large array produces an empty CSV with no error message.

Deeply nested JSON needs pre-processing. If your JSON has objects nested more than 2 levels deep, use JSONPath Tester to extract the specific fields before converting — deep flattening produces unwieldy column names.

Arrays within objects. Fields that are arrays serialize as JSON strings in the cell. If you need each element as a separate row, pre-process the JSON first.

Re-import check. After converting, run the CSV back through CSV to JSON and compare with Diff Checker to confirm no data was lost.

🔗 Use These Together

🏁 Bottom Line

JSON-to-CSV conversion is a daily task for anyone bridging API data and spreadsheet workflows. The hard parts — sparse keys, nested objects, array fields — are handled automatically.

For full-circle data workflow: use Fake Data Generator to create sample JSON, convert here to CSV, then use CSV to JSON to reverse.