Skip to content
LocalOnly

JSON to CSV Converter

Stable

Flatten an array of JSON objects into spreadsheet-ready CSV.

Everything is processed locally in your browser

About JSON to CSV Converter

Convert an array of JSON objects into clean, spreadsheet-ready CSV in one step. This JSON to CSV converter builds the header row from your object keys, escapes commas and quotes correctly, and flattens nested fields so the result opens perfectly in Excel or Google Sheets. It handles ragged data where objects have different keys by unioning every column it finds.

Features

  • Auto-generates the header row from the union of all object keys
  • RFC 4180-compliant quoting for values containing commas, quotes or newlines
  • Flattens nested objects into dotted column names (e.g. address.city)
  • Serializes nested arrays into a single cell so no data is dropped
  • Fills missing keys with empty cells to keep rows aligned
  • Choose your delimiter - comma, semicolon or tab - for locale-friendly output

How to use JSON to CSV Converter

  1. 1

    Paste a JSON array

    Provide an array of objects. Each object becomes one CSV row, and its keys define the columns.

  2. 2

    Review the columns

    The converter collects every key across all objects into a single header row and flattens nested fields into dotted columns.

  3. 3

    Download the CSV

    Export the result as a .csv file or copy it, then open it directly in Excel, Numbers, or Google Sheets.

Examples

Array of records to CSV

Object keys become the header row; each object becomes a row.

Input

[
  { "id": 1, "name": "Ada Lovelace", "role": "Engineer" },
  { "id": 2, "name": "Alan Turing", "role": "Mathematician" }
]

Output

id,name,role
1,Ada Lovelace,Engineer
2,Alan Turing,Mathematician

How JSON to CSV conversion works

A tree has to be squeezed into a grid

JSON is hierarchical and CSV is flat, so this conversion is a genuine change of shape rather than a change of syntax. The mechanism is flattening: nested paths become column headers, so `{"user":{"city":"Oslo"}}` produces a column called `user.city`. Every leaf value in the document needs its own column.

That works cleanly when the JSON is an array of uniform, shallow objects, which is the case CSV was designed for - one object per row, one field per column. It works less well the further you get from that shape, and understanding why saves a lot of frustration.

The awkward case is nested arrays. A user with three phone numbers has to become either three columns (`phones[0]`, `phones[1]`, `phones[2]`) or three rows, and neither is obviously right. Columns break as soon as someone has four numbers. Rows duplicate every other field. There is no third option, because the mismatch is structural.

How the columns get decided

The header row has to be fixed before any data is written, which means every possible column must be known up front. If the objects in your array have different keys - a common situation with optional fields - the converter has to scan them all to build the union of keys, and every row then carries empty cells for the fields it lacks.

That is why a heterogeneous array can produce a very wide, very sparse spreadsheet. Fifty objects that each use ten of a hundred possible fields yields a hundred columns that are ninety percent empty. The data is complete; the presentation is poor. When that happens, the better move is usually to split the array by record type and convert each group separately.

Column order follows first appearance, so the keys of the first object come first. If a stable, predictable column order matters - because a downstream import depends on it - sort the keys before converting.

The CSV side has its own hazards

CSV is barely standardised. RFC 4180 exists but predates most implementations and is widely ignored, so the details vary: comma or semicolon as the delimiter, CRLF or LF as the line ending, whether quotes are doubled or backslash-escaped, and whether a byte order mark is expected.

Excel is the main reason these choices matter. On systems where the list separator is a semicolon - much of continental Europe - Excel will not split comma-delimited files into columns at all. It also needs a UTF-8 byte order mark to display non-ASCII characters correctly, and without one it will render accented and CJK text as mojibake.

Excel also transforms values on import in ways that lose data. Long numeric strings become scientific notation, so an ID like `1234567890123456` displays as `1.23457E+15`. Leading zeros are stripped, breaking postcodes and account numbers. Anything resembling a date is converted to one, which is how the gene name `SEPT2` became a date and prompted the genetics community to rename several genes. None of this is caused by the conversion, but all of it will be blamed on it.

Reference

How each JSON shape converts

Input shapeResultAdvice
Array of flat objectsOne row per object - cleanThe ideal case
Array of nested objectsDotted column namesFine to a few levels deep
Nested arraysIndexed columns or duplicated rowsConsider one CSV per nested collection
Objects with differing keysUnion of all columns, sparsely filledSplit by record type first
A single objectOne header row and one data rowWorks, though rarely what you want
Deeply nested (8+ levels)Very long column namesExtract the relevant subtree first

Which tool should you use?

These tasks overlap. Here is how to pick the right one for what you are actually doing.

You have an array of uniform records for a spreadsheet
This is exactly what the conversion is for and it will be clean.
The JSON is deeply nested or heterogeneous
Extract the subtree you actually need with the JSON Path tool first. Converting the whole document produces an unusable sheet.
You want flat keys rather than a spreadsheet
The JSON Flatten tool gives you dotted paths without the CSV layer.
You are importing a spreadsheet back into JSON
The CSV to JSON tool reverses this, and understands dotted headers as nesting.

Use cases

  • Export an API's JSON response into a spreadsheet for analysis
  • Prepare JSON records for a bulk database or CRM import
  • Share structured data with non-technical stakeholders in Excel
  • Convert a JSON log dump into CSV for pivot tables
  • Generate a CSV seed file from JSON test fixtures

Troubleshooting common errors

Excel shows everything in one column

Why: Your locale's list separator is a semicolon, so Excel does not split on commas.

Fix: Use Data → From Text/CSV and choose comma as the delimiter, rather than double-clicking the file.

Accented or CJK characters display as garbage

Why: Excel assumes a legacy encoding unless the file carries a UTF-8 byte order mark.

Fix: Import via Data → From Text/CSV and select UTF-8 explicitly.

Long ID numbers appear in scientific notation

Why: Excel treats long digit strings as numbers and reformats them. Above 15 digits it also discards precision permanently.

Fix: Set the column type to Text during import. Once Excel has rounded the value, saving the file loses the original digits for good.

Leading zeros disappeared from postcodes or account numbers

Why: Excel parsed them as numbers.

Fix: Import the column as Text. There is no way to recover the zeros after the fact.

The CSV has far more columns than expected

Why: The array contained objects with different key sets, so the header is the union of all of them.

Fix: Group the records by type and convert each group separately.

Limitations

What this tool deliberately does not do, so you know when to reach for something else.

  • Nested arrays cannot be represented faithfully - they become indexed columns or duplicated rows.
  • Heterogeneous objects produce a wide, sparse header row.
  • Type information is lost; CSV has no way to distinguish the number 42 from the string "42".
  • Null and empty string both become an empty cell and cannot be told apart afterwards.
  • Spreadsheet applications reformat values on import, which no exporter can prevent.

Frequently asked questions

Learn more

Command Palette

Search for a tool or command