JSON Tools

JSON to CSV Converter: Export JSON Data to Spreadsheets

Convert JSON arrays to CSV format instantly. Export API data to Excel, Google Sheets, or any database with a single click.

Published January 15, 2025Updated June 1, 20255 min read

Try the free online tool

Runs entirely in your browser — no signup, no uploads.

Open Tool

JSON is the native format of web APIs, but business teams, data analysts, and database administrators often need data in CSV — a format that Excel, Google Sheets, pandas, and virtually every database import wizard understands natively. Converting between the two manually is tedious and error-prone.

A JSON-to-CSV converter takes a JSON array of objects, extracts all unique keys as column headers, and writes each object as a row. The result is a clean, comma-separated file that you can open directly in a spreadsheet application or import into a relational database.

This tool handles the most common conversion challenges automatically: nested objects are flattened, arrays within objects are serialized to strings, and values containing commas or quotes are properly escaped so the CSV opens correctly in any application.

What Is CSV and How Does It Relate to JSON?

CSV (Comma-Separated Values) is a plain-text tabular format where each line is a record and fields within a line are separated by commas. It is the universal data exchange format for spreadsheets and relational databases — virtually every tool that handles tabular data can read and write CSV.

JSON and CSV represent data very differently. JSON is hierarchical and can express nested objects and arrays of arbitrary depth. CSV is flat — it has rows and columns. Converting JSON to CSV requires flattening the hierarchy into a two-dimensional table, which works perfectly when your JSON is an array of flat objects (like API list endpoints), and requires decisions about nested fields.

The conversion is lossless for flat JSON arrays. For complex nested structures, some information about hierarchy is lost in the flattening process. If you need to preserve nesting, consider exporting to JSON Lines format or using a database that supports JSON columns.

  • Flat key-value objects map directly to CSV columns — the simplest and most reliable case
  • Nested objects can be flattened with dot notation (`address.city` becomes a column named `address.city`)
  • Array values within objects are typically serialized as quoted strings
  • Missing keys in some objects produce empty cells in those rows
  • Special characters in values (commas, quotes, newlines) are escaped per RFC 4180

How to Use This Tool

The converter works best with a JSON array of objects where all objects share similar keys. This matches the output of most REST API list endpoints.

  1. 1

    Paste your JSON array

    Paste a JSON array (starting with `[` and ending with `]`) into the input area. Each element should be an object representing one row of data.

  2. 2

    Preview the column headers

    The tool auto-detects all unique keys across all objects and lists them as column headers. Deselect any columns you do not need in the output.

  3. 3

    Configure options

    Choose your delimiter (comma, semicolon, or tab), whether to include a header row, and how to handle nested objects (flatten or stringify).

  4. 4

    Convert and preview

    Click Convert to see a preview of the first few rows in the result panel. Verify the columns and values look correct.

  5. 5

    Download the CSV

    Click Download CSV to save the file. Open it directly in Excel, Google Sheets, or import it into a database.

Common Use Cases

JSON-to-CSV conversion bridges the gap between modern web APIs and the spreadsheet-centric workflows of business teams.

  • Exporting API data for reporting — pull data from a REST API, convert the JSON response to CSV, and hand it to a business analyst in their preferred format.
  • Database seeding — convert JSON fixture data to CSV for bulk import using `COPY` (PostgreSQL) or `LOAD DATA INFILE` (MySQL).
  • Data pipeline staging — many ETL tools (Airbyte, Fivetran, dbt) accept CSV as an intermediate format between source and destination.
  • Spreadsheet analysis — load JSON data into Excel or Google Sheets for pivot tables, charts, and ad-hoc analysis without writing custom scripts.
  • Backup and archiving — convert JSON log records to CSV for long-term archival in storage systems optimised for tabular data.

Tips and Best Practices

A successful JSON-to-CSV conversion depends on the shape of your input data and the requirements of the consuming application.

  • Flatten before converting — if your JSON has deeply nested objects, pre-process them (using `jq` or a script) to a flat structure before converting, giving you full control over column names.
  • Use semicolons for European locales — Excel in European regions defaults to semicolons as delimiters because commas are used as decimal separators. Use the semicolon option if recipients will open the file in those locales.
  • Quote all fields if in doubt — quoting every field (not just those with special characters) is safer and avoids edge cases with values that happen to contain commas.
  • Check encoding — CSV files should be saved as UTF-8 with BOM for best Excel compatibility, or UTF-8 without BOM for Unix tooling and databases.
  • Validate row count — confirm the number of rows in the CSV matches the number of objects in the JSON array before handing off the file.

Frequently Asked Questions

What JSON structure works best for CSV conversion?

An array of flat objects where every object has the same keys is the ideal input. This maps directly to a table: one object per row, one key per column. If objects have different keys, missing values produce empty cells, which is still handled correctly.

How are nested objects handled?

Nested objects are typically flattened using dot notation. For example, `{"address": {"city": "Paris"}}` becomes a column named `address.city`. Some tools stringify the nested object as a JSON string instead. Check the output preview to confirm the behavior matches your expectations.

How do I convert JSON to CSV in Python?

Use the built-in `csv` module and `json` module: `import json, csv; data = json.load(open('data.json')); writer = csv.DictWriter(open('out.csv','w'), fieldnames=data[0].keys()); writer.writeheader(); writer.writerows(data)`. The `pandas` library is even simpler: `pd.read_json('data.json').to_csv('out.csv', index=False)`.

Can I convert CSV back to JSON?

Yes, the reverse conversion is also straightforward. Each row becomes a JSON object with column headers as keys. Use our CSV-to-JSON tool, or in Python use `pd.read_csv('file.csv').to_json('out.json', orient='records')`.

Why does my CSV look wrong when I open it in Excel?

Common causes: the wrong delimiter (use semicolons for European Excel locales), missing UTF-8 BOM (Excel interprets UTF-8 without BOM as ANSI, breaking accented characters), or date fields being misinterpreted as date types. Try importing via Data > From Text/CSV instead of double-clicking the file.

How do I handle arrays inside JSON objects when converting to CSV?

Arrays within objects are typically serialized as a quoted JSON string in the CSV cell, since CSV has no native concept of a list. If you need the array values as separate columns, transform the JSON first to explode the array into individual keys before converting.

json to csvjsoncsv converterexport jsonspreadsheet

Ready to use this tool?

Free, instant, no account required. Runs entirely in your browser.

Open Tool

More JSON Tools Guides