How to convert JSON to CSV

A JSON array of objects is already a table — each object is a row, its keys are the columns. Converting to CSV makes that table readable in any spreadsheet, and here is how it works, including the quoting rules and the nested-data problem.

JSON is a table in disguise

Each object is a row, each key a column

A JSON array of objects is already a table: each object is a row, and its keys are the columns. Converting to CSV makes that structure visible to tools that never learned JSON — spreadsheets, databases, data-analysis tools, and colleagues who work in Excel. The conversion itself is mechanical: collect every key into a header row, then write one CSV row per object.

Headers in first-appearance order, empty cells

Headers are collected in the order they first appear, and every object contributes its keys — so if the third object has a key the first two lack, it still gets a column. Rows that do not have a value for a column get an empty cell. The result is a rectangular table, which is what spreadsheets expect. A single object on its own becomes a one-row table.

The quoting rules that matter

Commas, quotes and line breaks get wrapped

CSV looks simple until a value contains a comma. The standard rules handle it: any field containing a comma, a quote or a line break is wrapped in double quotes, and a quote inside a field is doubled. A product named Chair, wooden therefore arrives in one cell, not split across two — and a spreadsheet reading the file will put it back together correctly.

Never convert by hand with find-and-replace

These rules are why you should never convert by hand with find-and-replace. A naive join with commas breaks the moment a value contains one, and the break is silent — the file looks fine until someone sorts it and finds half a product name in the wrong column. A converter that quotes properly is the difference between data and a mess.

Nested data and the flattening problem

JSON allows nesting; CSV does not. An object inside an object, or an array inside a value, has no natural home in a flat table. The honest options are two: flatten the nested value into a JSON string inside one cell, preserving the data in readable form, or expand it into extra columns, which needs a decision about how deep to go.

This converter takes the first option: nested objects and arrays become their JSON text in a single cell. The data is preserved and still readable, but it is not split into columns. If you need one column per nested field — a details.size column, say — flatten the JSON first, in code or with a dedicated tool, and then convert.

Convert JSON to CSV in the browser

  1. Open the JSON to CSV Converter and paste a JSON array of objects into the Input box.
  2. Click Convert to CSV. The first row of the output is the header row, built from the object keys.
  3. Check the row and column count in the success message — it should match what you expect from the data.
  4. Click Copy output or Download to save the CSV file.
  5. Open the downloaded file in Excel, Google Sheets or any tool that reads CSV.

Opening the CSV in a spreadsheet

The most common destination is a spreadsheet: open the downloaded file in Excel, Google Sheets or LibreOffice and the table appears, ready to sort, filter and chart. If the file opens with everything in one column, the cause is usually a regional setting — some locales expect a semicolon separator. Open the file through the import wizard, choose comma as the separator, and the columns will appear.

A spreadsheet is also where small data-cleaning jobs become easy. Once the CSV is open, you can sort by any column, filter out rows you do not need, remove duplicates, and spot the empty cells where an object was missing a key. Do that tidying in the spreadsheet, not by editing the JSON — the table view makes problems visible in a way a wall of brackets never does.

Going the other way

CSV to JSON is the reverse trip, and it has its own quirks: the first row becomes the field names, quoted fields need proper parsing, and every value comes out as a string because CSV carries no type information. Our CSV to JSON Converter handles that direction with the same care — quoted commas, doubled quotes and all.

Round-tripping is possible but lossy in one direction: JSON to CSV and back gives you strings where numbers and booleans used to be, and nested values stay flattened. Keep the original JSON if you need the types back.

Related guides

Questions people ask

What if my objects have different keys?

Headers are the union of all keys across all objects, in the order they first appear. An object missing a key gets an empty cell in that column, so every row stays aligned.

What happens to nested objects?

They are flattened to JSON strings inside their cells, not expanded into columns. A tags array becomes its JSON text in one cell, preserving the data in readable form.

Why do some fields have quotes?

Fields containing a comma, a quote or a line break must be quoted, or a spreadsheet would split them. Quotes inside a field are doubled, following the standard CSV rules.