JSON to CSV

Convert JSON arrays to CSV format. Nested objects are flattened with dot notation.

Paste JSON array here, e.g., [{"name": "John", "age": 30}]
Loading editor...
Loading editor...

JSON to CSV Converter — Export JSON Arrays to Spreadsheets

Understanding the Basics

CSV (Comma-Separated Values) is the universal lingua franca for tabular data, supported by every spreadsheet application (Excel, Google Sheets, LibreOffice Calc), data analysis library (pandas, R, dplyr), and database import tool. While JSON is ideal for hierarchical, nested, or polymorphic data, CSV excels when data is uniformly tabular — the same set of columns for every row. Converting a JSON array of objects to CSV is one of the most frequently needed data engineering micro-tasks: exporting API results for business stakeholders, preparing training datasets for machine learning pipelines, importing records into database tables via CSV bulk load, and sharing data with colleagues who prefer spreadsheets over JSON. The conversion is straightforward for flat JSON arrays: each array element becomes a CSV row, and the union of all object keys becomes the CSV header row. Complexity arises with nested objects and arrays, which must be either flattened (producing dot-notation column names like address.city) or stringified. Handling escaping of quotation marks and comma separation characters correctly is critical to prevent format corruption. Our converter uses the PapaParse library to produce correctly quoted, RFC 4180-compliant CSV output.

How to Use the Tool

  1. Paste a JSON array of objects into the input editor (e.g., [{"name":"Alice","age":30}, {"name":"Bob","age":25}]).
  2. The converter infers the header row from the union of all unique keys across all array elements.
  3. Click "Convert" — each object maps to a CSV row with values aligned to the inferred columns.
  4. Missing fields in sparse objects are represented as empty cells.
  5. Download the resulting .csv file or copy the CSV text for pasting into Excel or Google Sheets.

Key Features & Specifications

  • Automatically infers CSV headers from the union of all object keys across the input array
  • RFC 4180-compliant output: values containing commas or quotes are correctly double-quoted
  • Handles sparse arrays where not every object has the same set of keys
  • Nested object values can be optionally flattened (address.city) or stringified
  • Download as .csv file or copy as plain text for direct paste into spreadsheets

Frequently Asked Questions (FAQ)

Q:What happens if my JSON objects have different keys?
The converter uses the union of all keys found across all objects as the header. Objects missing a key will have an empty cell for that column. This handles sparse or evolving schemas gracefully.
Q:My CSV values contain commas — will they break the CSV format?
No. The converter wraps any value containing a comma, newline, or double-quote in double-quotes per the RFC 4180 standard. Double-quotes within a value are escaped as two consecutive double-quotes ("").
Q:Can I convert a JSON object (not an array) to CSV?
Not directly, because CSV represents rows of uniform data. If your JSON is a single object, it would produce a one-row CSV. If you have a nested object where each property represents a record, you should restructure it as an array first using our JSON editor.