OnlyFormat

JSON to CSV Converter

Convert JSON arrays to CSV format instantly. Paste text or upload a .json file.

No data sent to server
JSON Input
CSV Output

Related Tools

What is JSON to CSV?

JSON dominates web APIs; CSV dominates spreadsheets and BI tools. Converting JSON → CSV bridges that gap, letting you take API responses, MongoDB exports, or log data and analyze them in Excel, Google Sheets, Tableau, or import into databases.

Common scenarios: API response analysis (paste API output into Excel for deeper analysis), NoSQL → SQL migration (MongoDB JSON → PostgreSQL via CSV import), data deliverables for non-technical stakeholders, backup/audit logs for spreadsheet review.

Conversion example

# JSON input
[
  { "name": "Alice", "age": 30, "city": "Seoul" },
  { "name": "Bob",   "age": 25, "city": "Tokyo" }
]

# CSV output
name,age,city
Alice,30,Seoul
Bob,25,Tokyo

Handling complex structures

  • Different keys per object: tool collects all unique keys as headers; missing values are empty
  • Nested objects: serialized as JSON strings inside cells (preserves data, but ugly in spreadsheet view)
  • Arrays inside objects: same — serialized as JSON strings
  • Nested array of objects: not flattened — keep at top level for clean CSV
  • Boolean/null values: true/false kept as text; null becomes empty string
  • Special characters in values: commas/quotes/newlines properly escaped per RFC 4180

For deeply nested JSON

If your JSON has many nested levels (3+ deep), CSV is the wrong format — flat tables can’t represent hierarchies cleanly. Options:

  • Pre-flatten with jq: jq '[.users[] | {name, email, status}]' input.json
  • Pre-flatten with Python: pandas’ json_normalize() handles nesting elegantly
  • Use Parquet or Arrow instead: better for hierarchical analytics data
  • Stay in JSON: use jq for filtering instead of converting

How to Use

  1. Paste a JSON array of objects, or upload a .json file.
  2. Click Convert.
  3. Review the CSV — open in Excel/Sheets to verify columns and rows.
  4. Copy or download as .csv.

Privacy: All conversion runs in your browser. No upload.

Flattening a Tree Into a Table

JSON nests and CSV does not, so this conversion is fundamentally about deciding what to do with structure that has nowhere to go. An array of flat objects converts perfectly — each object becomes a row, each property a column. Anything deeper requires a compromise.

That is why the conversion works beautifully for API responses that are essentially tabular, such as a list of orders or users, and awkwardly for deeply nested documents. If your JSON has objects inside arrays inside objects, expect to make choices about which parts become columns and which are dropped or stringified.

Why the Column Order and Set Can Surprise You

JSON objects in a list are not required to have the same properties. One record might include a middle name and the next might not, and the format is perfectly happy with that. CSV is not — every row must line up under the same header.

The practical consequence is that a column set has to be derived from the data, and any property missing from a given record becomes an empty cell. If the first few records happen to lack a field that appears later, a naive converter can miss the column entirely.

It is worth opening the result in a spreadsheet and checking the column headers against what you expected before treating the CSV as complete.

FAQ

How are nested objects handled?

Serialized as JSON strings in cells (e.g., "address":{"city":"Seoul"} becomes a single cell with that JSON inside). Preserves data but isn’t spreadsheet-friendly. Pre-flatten with jq for cleaner output.

What if objects have different keys?

All unique keys across all objects are collected as headers. Missing values are empty. This is correct behavior for sparse data.

My CSV opens with weird characters in Excel — fix?

Excel auto-detects encoding poorly. Save the file as .csv, then in Excel: Data → From Text/CSV → choose UTF-8 encoding. Or download with BOM (most tools include this option).

Can I convert a single JSON object (not an array)?

Single objects produce a 2-column CSV (key, value). Wrap in [...] first if you want a single-row table format.

How big can the JSON be?

Up to ~50 MB processes smoothly in browser. For larger data, use jq CLI: jq -r ’...’ | csvkit pipe.

What happens to nested objects?

They cannot become columns directly. Depending on depth they are either flattened into dotted column names or serialised as text within a single cell. Deeply nested data is usually better handled with a purpose-written script.

Why are some cells empty?

Because that record did not have the property. JSON allows records with different shapes; CSV requires every row to fit the same columns, so missing properties become blanks.

Will values containing commas break the CSV?

No. Values containing commas, quotes, or line breaks are quoted and escaped according to the CSV convention, so spreadsheets read them correctly.

Does it work with a single object rather than an array?

An array of objects is the natural input, since that maps onto rows. A single object produces a single row.

Which columns appear, and in what order?

The column set is derived from the properties present across the records, so a property that appears in only some records still gets a column with blanks elsewhere. Check the headers before treating the export as complete.

Can I open the result directly in Excel?

Yes. Values containing commas, quotes, or line breaks are quoted according to the CSV convention, which every spreadsheet application understands.

⚠️ Reference Only

Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.

Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.