100% local

JSON to CSV Converter

data_object JSON Input
task_alt CSV Output

JSON to CSV Converter

Flatten an array of objects into a spreadsheet table. Keys become the header row, records become rows, and values that would break the format are quoted for you.

CSV is a flat, rectangular format and JSON is a nested, ragged one, so this conversion is genuinely lossy in shape even when no value is lost. Every record has to occupy one row with the same columns as every other record, which means the converter has to decide what to do about keys that only some records have and values that are not scalars.

The answers here are the pragmatic ones. The header row is the union of every key seen across every record, in the order the keys were first encountered. A record missing one of those keys gets an empty cell. A value that is itself an object or an array is written into the cell as JSON text. Nothing is dropped, but a nested structure arrives in the spreadsheet as a string rather than as columns.

Quoting rules and the two things Excel will argue with

A field is wrapped in double quotes only when it has to be, which is when it contains a comma, a double quote, or a newline. Inside a quoted field, each double quote is doubled, so the value said "hi" becomes the field with doubled inner quotes. Everything else is written bare, which keeps the output readable and diffable rather than uniformly quoted.

Two deliberate deviations from RFC 4180 are worth knowing before you hand the file to someone. First, records are separated with a single line feed rather than the carriage return and line feed pair the specification requires. Nearly every tool accepts line feeds, but a strict RFC 4180 parser is entitled to complain. Second, no byte order mark is written. Excel on Windows reads a UTF-8 CSV without a byte order mark using the system code page, which turns non ASCII names into mojibake.

Both are easy to work around. If Excel garbles accented or CJK text, import the file through the Data then From Text dialog and select UTF-8 explicitly instead of double clicking it, or prepend a byte order mark with a text editor. Google Sheets and LibreOffice both detect UTF-8 correctly and need neither workaround.

How each JSON value becomes a cell

Each row shows a value inside a record and the exact text this tool writes into the cell.

JSON valueCSV cellNotes
"Alan"AlanNo special characters, so no quoting is added.
"Ada, A.""Ada, A."Quoted because of the comma, which would otherwise split the field.
"said \"hi\"""said ""hi"""Quoted, and each inner double quote is doubled.
{"city":"Seoul"}"{""city"":""Seoul""}"Serialized as JSON text, then quoted because that text contains quotes.
["x","y"]"[""x"",""y""]"Arrays get the same treatment. They arrive as a string, not as extra columns.
null(empty)Written as an empty cell. A missing key produces the same result, so the two are indistinguishable.
true / 9.5true / 9.5Booleans and numbers are written bare, exactly as they read in JSON.

Converting records with uneven keys

The second record lacks note and meta, and adds tags. Watch where tags lands in the header.

Input
[
  { "id": 1, "name": "Ada, A.", "note": "said \"hi\"",
    "meta": { "city": "Seoul" }, "score": 9.5 },
  { "id": 2, "name": "Alan", "tags": ["x", "y"], "score": null }
]
Output
id,name,note,meta,score,tags
1,"Ada, A.","said ""hi""","{""city"":""Seoul""}",9.5,
2,Alan,,,,"[""x"",""y""]"

The header is the union of all keys in first seen order, so tags is last even though it belongs to the second record. Cells for keys a record does not have are empty, and so is the cell for the null score.

Common Pitfalls

Empty cell means either null or absent, with no way to tell them apart

A key holding null and a key that is missing entirely both produce an empty cell. If that distinction matters in your data, CSV cannot carry it and you need to encode it yourself, for example by substituting a sentinel string before converting. This is a limitation of the format, not of the tool.

Nested data becomes a string, not columns

An object under a key arrives in one cell as JSON text. It is not flattened into columns like user.city, and a spreadsheet will treat it as an opaque string. If you want real columns, flatten the structure in your own code before converting, or convert the nested arrays separately as their own tables.

Excel on Windows may garble non ASCII text

The output is UTF-8 with no byte order mark. Double clicking the file on Windows makes Excel guess the system code page, which corrupts accented and CJK characters. Import through the Data then From Text dialog and choose UTF-8, or add a byte order mark first. Sheets and LibreOffice handle it correctly either way.

How to Use

  1. Paste a JSON array: Paste an array of records, such as a list endpoint response or a query result you want in a spreadsheet.
  2. Click Convert: The tool extracts all unique keys as column headers and converts each object to a row.
  3. Copy or download: Copy the CSV output and paste it into Excel, Google Sheets, or save it as a .csv file.

Key Features

  • Automatic column header detection from all unique object keys
  • Proper CSV escaping for commas, quotes, and newlines in values
  • Handles missing keys gracefully: empty cells for absent fields
  • Nested objects and arrays are serialized as JSON strings in cells

Use Cases

  • Exporting API data to spreadsheets for analysis or reporting
  • Converting JSON database exports to CSV for import into other tools
  • Creating CSV datasets from JSON log files

Frequently Asked Questions

What JSON structure works best for CSV?

An array of objects with consistent keys works best. Each object becomes a row, and each key becomes a column header.

How are nested objects handled?

They are serialized as JSON text inside a single cell, then quoted because that text contains double quotes. They are not expanded into separate columns.

What if objects have different keys?

The header row is the union of every key found across all records, ordered by when each key was first seen. A record that lacks one of those keys gets an empty cell for it.

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

Yes. A single object is treated as a one-row table, with keys as headers and values as the single data row.

Are nested objects flattened into separate columns?

No. A nested object arrives in one cell as JSON text. Flatten the structure in your own code first if you want each nested field as its own column.

Why does Excel show my Korean or accented text as garbage?

The output is UTF-8 without a byte order mark, and Excel on Windows falls back to the system code page when it cannot find one. Import the file through Data then From Text and select UTF-8 rather than double clicking it. Google Sheets and LibreOffice detect the encoding correctly.

Does the output use CRLF line endings?

No, records are separated by a single line feed. Virtually every spreadsheet and parser accepts this, but a strict RFC 4180 implementation expects a carriage return and line feed pair, so convert the line endings if you are feeding a pedantic consumer.