HomeJSON ToolsJSON to CSV Converter

JSON to CSV Converter

Convert a JSON array of objects to a clean CSV file instantly — headers auto-detected from your keys, values correctly quoted, download-ready. No spreadsheet skills needed, nothing leaves your browser.

Convert a JSON array of objects to a clean CSV file instantly — headers auto-detected from your keys, values correctly quoted, download-ready. No spreadsheet skills needed, nothing leaves your browser.

This tool is designed to provide a seamless experience for developers by handling complex operations directly in your browser with maximum speed and security.

100% Private
Instant Results
Customizable
Offline Ready
Dev-Friendly
Easy Export

JSON and CSV are both data formats, but they serve different audiences. JSON — JavaScript Object Notation — is what APIs return and what developers work with directly in code. It handles nested structures, arrays, mixed types, and hierarchical relationships naturally. CSV — Comma Separated Values — is flat, tabular, and universally understood by Excel, Google Sheets, Tableau, Power BI, and virtually every data analysis tool ever built. Converting between them is not just a format change — it is a translation between two different ways of thinking about data.

The conversion works when your JSON is an array of objects where each object has the same set of keys. Each object becomes a row. The keys of the first object become the column headers. The values fill in the cells. A JSON array of 500 user records with fields like id, name, email, and role becomes a 500-row CSV with those four columns in about a second. That CSV can be opened directly in Excel, imported into a database, uploaded to a CRM, or sent to a data analyst who has never written a line of code.

The challenge comes with nested JSON — objects that contain other objects or arrays. A flat CSV cannot represent hierarchy, so the converter has to make a decision about how to handle it. This tool flattens nested objects using dot notation — a nested field like address.city becomes a column named address.city in the output. Nested arrays are serialized as a string value in the cell. Understanding this behavior upfront prevents confusion when the CSV output does not look exactly like the JSON structure.

Read the Full Guide

This tool takes a JSON array of objects and converts it into a properly formatted CSV. It auto-detects column headers from the keys in your JSON objects — you do not need to specify them manually. Values are correctly quoted when they contain commas, newlines, or double quotes, following the RFC 4180 CSV standard that Excel and Google Sheets expect. The result can be copied to your clipboard or downloaded directly as a .csv file. It handles the details that manual conversion always gets wrong. Values containing commas are wrapped in double quotes so they stay in one cell instead of splitting across multiple columns. Values containing double quotes have those quotes escaped with a second double quote as the standard requires. Null and undefined values are written as empty cells rather than the literal string null. Boolean values are written as true or false rather than 1 and 0 unless the data already uses integers. The JSON Schema button lets you inspect the detected structure of your input before converting — useful when you want to verify that the tool has correctly identified all the columns before generating a large CSV. The output updates immediately after you click Generate CSV Data, and the result panel shows a preview so you can spot obvious issues before downloading.

1. Paste your JSON array into the Input JSON field — your JSON must be an array of objects, starting with [ and ending with ]. Each object in the array will become one row in the CSV. If your JSON is a single object rather than an array, wrap it in square brackets first: [{your object here}]. Click Load Example to see valid input format if you are unsure.

2. Click the Schema button to preview the detected column structure before converting — this shows you which keys the tool found across all your objects and what column headers the CSV will use. This is especially useful for large JSON arrays where you want to confirm all expected fields are present before generating the file.

3. Click Generate CSV Data — the tool processes your entire JSON array, auto-detects headers from the object keys, quotes values that contain commas or double quotes, and writes empty cells for null or missing values. For typical API responses with hundreds or thousands of records this completes in under a second.

4. Review the CSV preview in the result panel below the Generate button — check that the column headers look right, spot-check a few rows to verify the values are in the correct columns, and confirm that any fields containing commas are correctly wrapped in double quotes rather than split across multiple columns.

5. Click Copy to copy the CSV to your clipboard, or click Download to save it as a .csv file directly to your device. The downloaded file opens directly in Excel, Google Sheets, LibreOffice Calc, or any other spreadsheet application without any additional configuration.

Every data-driven team I have worked with has this exact situation: the developer has the data in JSON because that is what the API returns, and everyone else on the team needs it in a spreadsheet because that is what they actually use. The product manager needs it in Google Sheets to build a report. The support team needs it in Excel to filter and search. The data analyst needs it in CSV to import into their BI tool. Without a converter, the developer ends up manually reformatting data — copy, paste, fix the columns, deal with the commas, save as CSV. It takes 20 minutes and introduces errors. With this tool, it takes 10 seconds. The use case I hit most often is exporting API responses. You call a third-party API, get back a JSON array of records, and need to hand that data to someone who works in spreadsheets. Paste the JSON, click Generate, download the CSV, done. No Python script to write, no Excel macros to configure, no intermediate tool to install. The same applies to database exports — most databases can export query results as JSON, and this tool bridges that JSON back to the CSV format that reporting tools expect. There is also a quality control use case that people underestimate. Converting your API response to CSV and opening it in Excel immediately shows you data problems that are invisible in raw JSON — a field that has inconsistent types across records, values that contain unexpected commas, records where a field is null that should not be, or columns that appear in some objects but not others. The spreadsheet makes these structural problems obvious in a way that reading raw JSON does not.

Auto-detected headers — column names are extracted automatically from your JSON object keys with no manual configuration required

RFC 4180 compliant output — values containing commas newlines or double quotes are correctly quoted and escaped so the CSV opens without errors in Excel and Google Sheets

Download as .csv — the converted output can be saved directly as a .csv file ready to open in any spreadsheet application

100% browser-based — your JSON data never leaves your machine and is never sent to any server

Handles null and missing values — null values write as empty cells and fields missing from some objects write as empty cells in those rows rather than breaking the conversion

Schema preview — inspect detected column structure before generating the full CSV to catch unexpected fields or missing keys early

Instant conversion — processes JSON arrays with thousands of records in under a second with no server round-trip

Works with any JSON array — handles API responses database exports fixture files log data and any other JSON array of objects regardless of the source

Exporting API response data to share with non-technical team members in Excel or Google Sheets

Converting database query results exported as JSON into CSV for BI tool imports

Preparing user or customer records from a JSON export for CRM upload or bulk email campaign

Transforming product catalog JSON from an e-commerce API into a spreadsheet for inventory review

Converting analytics event data from JSON logs into CSV for data analysis

Exporting JSON configuration or metadata for review by non-developer stakeholders

Creating CSV test data from a JSON fixture file for spreadsheet-based QA testing

Auditing API response data structure by converting to CSV and reviewing in a spreadsheet

Example Input

[
  {"id": 1, "name": "Priya Singh", "email": "priya@learnhubly.com", "role": "Admin", "active": true, "joined": "2024-01-15"},
  {"id": 2, "name": "Jane Smith", "email": "jane@example.com", "role": "User", "active": true, "joined": "2024-03-22"},
  {"id": 3, "name": "Bob Johnson", "email": "bob@example.com", "role": "Editor", "active": false, "joined": "2024-05-10"}
]

Example Output

id,name,email,role,active,joined
1,Priya Singh,priya@learnhubly.com,Admin,true,2024-01-15
2,Jane Smith,jane@example.com,User,true,2024-03-22
3,Bob Johnson,bob@example.com,Editor,false,2024-05-10

Invalid JSON: The input must be valid JSON. Missing commas between objects, unquoted keys, trailing commas, or single quotes instead of double quotes will all cause a parse error before conversion begins. Use the JSON Formatter & Validator tool first to fix any syntax errors in your JSON.

Not an Array: This tool requires the input to be a JSON array — a list of objects starting with [ and ending with ]. If you paste a single JSON object without the surrounding square brackets, the tool cannot generate rows. Wrap your object in square brackets to convert it as a one-row CSV.

Inconsistent Keys Across Objects: If your JSON objects have different keys — for example some records have an email field and others do not — the missing fields will appear as empty cells in the rows where they are absent. This is correct behavior but can be surprising. Use the Schema preview to see all unique keys detected across the entire array before generating.

Values Containing Commas Split Across Columns: If your CSV opens in Excel and a value that should be in one cell appears split across multiple columns, the value contained a comma that was not properly quoted. This tool handles quoting correctly for valid JSON input — if you see this issue, the most common cause is that the original data was manually edited after conversion. Regenerate from the original JSON.

Nested Objects and Arrays Appear as Strings: CSV is a flat format and cannot represent nested JSON structures. Nested objects are flattened using dot notation and nested arrays are serialized as a quoted string. If your JSON has deeply nested structures and you need proper column separation for nested fields, you will need to flatten your JSON first before converting — a process best handled in code for complex structures.

Pasting a JSON object instead of a JSON array

Fix: This tool converts JSON arrays — lists of objects — to CSV rows. A single JSON object like {"name": "Priya", "role": "Admin"} has no rows to generate. Wrap it in square brackets: [{"name": "Priya", "role": "Admin"}] and you get a one-row CSV. If your API returns a paginated response with the actual data inside a nested key like {"data": [...], "total": 100}, extract just the array value from the data key before pasting.

Opening the downloaded CSV in a text editor and thinking it is broken

Fix: A CSV file opened in a text editor looks like raw comma-separated text with no column alignment — that is correct and expected. The file is not broken. Open it in Excel, Google Sheets, or LibreOffice Calc to see the properly formatted table with columns and rows. If you open it in Excel and all data appears in column A, go to Data > Text to Columns and split by comma, or re-save the file with a .csv extension and open it fresh.

Expecting the CSV column order to match the JSON key order

Fix: JSON objects technically have no guaranteed key order — it depends on the JavaScript engine and how the JSON was serialized. Most modern engines preserve insertion order, but if your column order in the CSV does not match what you expected, that is why. If column order matters — for example when importing into a system that expects columns in a specific sequence — reorder the columns in Excel or Google Sheets after downloading, or pre-process the JSON to ensure key order before converting.

Using the CSV output directly in a database import without checking for encoding issues

Fix: This tool outputs UTF-8 encoded CSV, which is the correct standard for most modern systems. However, older Microsoft Excel versions on Windows default to opening CSV files in the system locale encoding rather than UTF-8, which causes special characters — accented letters, Chinese characters, emoji — to appear garbled. If you see this issue, open Excel, use Data > From Text/CSV, and explicitly select UTF-8 encoding during import rather than double-clicking the file to open it.

Treating the converted CSV as a full data export when the JSON had nested structures

Fix: If your original JSON had nested objects — for example a user object with an embedded address object containing street, city, and country fields — the CSV will have columns named address.street, address.city, and address.country using dot notation flattening. If the nested field was an array — for example a tags array with multiple values — the entire array is serialized into a single cell as a string. This is a structural limitation of CSV, not a bug. For complex nested data, consider flattening your JSON in code before converting, or use a JSON-native format like Parquet for data analysis.

Does it support MySQL and PostgreSQL export formats?

This tool converts JSON to standard CSV format — the universal format that MySQL, PostgreSQL, Excel, Google Sheets, and virtually every other data tool can read. If you have exported query results from MySQL or PostgreSQL as JSON, paste that JSON here to get a clean CSV back. Most databases also support exporting directly to CSV, but if you have the JSON and need the CSV, this is the fastest path.

Can it handle large JSON arrays with thousands of records?

Yes. The conversion runs locally in your browser using JavaScript and handles arrays with thousands of records in under a second for typical data shapes. For very large datasets — tens of thousands of records or objects with many deeply nested fields — performance depends on your device hardware, but the tool is designed to handle real-world API response sizes and database export sizes without issues.

What happens to nested objects and arrays in the JSON?

CSV is a flat format with no way to represent hierarchy. Nested objects are flattened using dot notation — a field like {"address": {"city": "Mumbai"}} becomes a column named address.city with the value Mumbai. Nested arrays are serialized as a quoted string in the cell — for example a tags field containing ["javascript", "nodejs"] becomes the string javascript,nodejs in that cell. If you need proper column separation for nested array values, flatten your JSON before converting.

Is my data safe when using this tool?

Yes. The conversion runs entirely in your browser — your JSON data is never transmitted to any server, never logged, and never stored. This matters because JSON data from real systems often contains user records, email addresses, internal IDs, financial figures, or other sensitive information. Browser-based processing means none of that data ever leaves your machine.

Why does Excel open my CSV with all data in one column?

This happens when Excel's regional settings use a semicolon as the list separator instead of a comma — common in European Windows locales where the comma is used as a decimal separator. To fix it, open Excel, go to Data, click From Text/CSV, select your file, and in the import dialog set the delimiter to comma explicitly. Alternatively, add sep=, as the very first line of the CSV file before the headers — Excel reads this as an instruction to use comma as the delimiter.

Can I convert the CSV back to JSON?

Not with this tool — JSON to CSV is a one-way conversion here. For converting CSV back to JSON, LearnHubly has a separate CSV to SQL tool in the related tools sidebar that may help depending on your use case. For a direct CSV to JSON conversion, most modern spreadsheet applications can export to JSON, or you can use a simple script in Python with the csv and json modules or in JavaScript with the Papa Parse library.

What does the Schema button do?

The Schema button analyzes your JSON array and shows you all the unique keys detected across every object in the array. This is useful before converting because it tells you exactly which column headers the CSV will have, and it reveals structural inconsistencies — for example if most objects have an email field but 10 records are missing it, the schema view shows that the email field exists but is not present in all records. Those 10 records will have an empty email cell in the CSV.

How do I convert JSON to CSV in Python or JavaScript without a tool?

In Python, use the built-in csv and json modules: load your JSON with json.loads(), then write the rows with csv.DictWriter which handles header detection and quoting automatically. In JavaScript, the most reliable approach is the Papa Parse library's unparse() function which handles all RFC 4180 edge cases including commas in values and escaped quotes. For one-off conversions this tool is faster, but for automated pipelines that run repeatedly, implementing it in code with a proper library is the right approach.