JSON to CSV Converter
Convert a JSON array of objects to CSV in your browser. Builds the header from all keys, quotes what needs quoting, nothing uploaded.
Your stuff stays yours. The conversion happens in this page's JavaScript. Nothing you paste here leaves your machine, and the tool keeps working with the network unplugged.
Feed it a JSON array of objects. The header row is the union of every key found across all objects, so ragged data still lines up; missing values become empty cells. Nested objects and arrays are embedded as JSON strings rather than dropped. Output opens directly in Excel, Google Sheets, and LibreOffice.
How to use the JSON to CSV converter
- Paste your JSON into the JSON in box. The top level must be an array, so the first non-space character should be
[. - Click Convert to CSV.
- Check the CSV out box. The first line is the header and each following line is one element of your array.
- Click Copy result, paste into an empty plain-text file, and save it with a
.csvextension. You can also paste straight into a spreadsheet, though some apps need their text import option to split the columns. Clear resets both boxes.
How objects become rows
CSV is a flat grid: a header line, then one line per record, with every line holding the same columns. JSON is a tree, so the converter follows a few fixed rules to squeeze it into that grid.
- Column order is first-seen order. The converter walks the array from the top and adds each key the first time it appears. Keys that only show up in later objects are added to the right end of the header.
- Values are written as text. Numbers keep their JSON form,
trueandfalseare written as words, andnullbecomes an empty cell. A key that is missing from an object is also an empty cell, so in the CSV you cannot tell null from missing. - Nested values are written as compact JSON, with no spaces, inside a single cell.
- Quoting is applied only when needed. A cell is wrapped in double quotes if it contains a comma, a double quote, or a line feed, and any quotes inside it are doubled. Header names follow the same rule.
- Lines end with a line feed (LF), and there is no newline after the last row. RFC 4180 describes CRLF line endings, but Excel, Google Sheets, LibreOffice, and most CSV libraries read LF files without trouble.
A worked example
These three objects have different keys, a comma and quotes inside a name, a null, an array, and a nested object:
[
{"id": 1, "name": "Lovelace, Ada", "tags": ["math", "poetry"]},
{"id": 2, "name": "Grace \"Amazing\" Hopper", "active": true, "manager": null},
{"id": 3, "address": {"city": "London"}}
]
Clicking Convert to CSV produces:
id,name,tags,active,manager,address
1,"Lovelace, Ada","[""math"",""poetry""]",,,
2,"Grace ""Amazing"" Hopper",,true,,
3,,,,,"{""city"":""London""}"
The header has six columns because six distinct keys appear across the array, listed in the order the converter first met them. Row 2 has an empty manager cell for its null. The tags array and the address object are stored as JSON text, and since that text contains quotes, each quote is doubled and the whole cell is quoted. A spreadsheet will show the cell as ["math","poetry"].
Common problems and how to fix them
"Input must be a JSON array of objects."
Most API responses wrap the list in an object, such as {"data": [ ... ]} or {"results": [ ... ]}. The converter does not search inside for the array. Copy just the array, from its [ to its matching ], and paste that. The JSON formatter makes the structure easier to see if the response arrived on one line.
The header says 0,1,2 and every cell is one letter
This happens when the array holds plain strings, like ["ab","cd"]. Each string is treated as an object whose keys are character positions, so the output is 0,1 followed by a,b and c,d. An array of numbers gives only empty lines. Turn each item into an object first, for example [{"value":"ab"},{"value":"cd"}].
Leading zeros disappear when the file is opened
The CSV itself still says 02134, but spreadsheet apps guess that the column is numeric and strip the zero on open. Import the file instead of double-clicking it, and set that column's type to Text during the import.
Accented characters look garbled in Excel
The copied text is Unicode. If you save it as UTF-8 and double-click the file, Excel on Windows may read it with a legacy code page and show é where é should be. Use Excel's Data tab to import from text or CSV and choose UTF-8 as the file origin.
A cell turned into a formula
Values that begin with =, +, -, or @ are written unchanged, and spreadsheet apps may evaluate them as formulas. If the data came from untrusted users, prefix those values with a single quote or a space before converting, or import the column as text.
Related tasks
For the opposite direction, the CSV to JSON converter turns a header row and data rows back into an array of objects. If your source data is YAML, convert it with the YAML to JSON converter first.
Questions this tool gets asked
What input shape does this expect?
A JSON array of objects, the shape most APIs return for lists. Each object becomes one CSV row.
How are nested objects handled?
A nested object or array is serialized as a JSON string inside its cell, so no data is silently discarded. Flatten before converting if you want nested keys as separate columns.
Will the CSV open in Excel?
Yes. Fields containing commas, quotes, or line breaks are quoted per RFC 4180, which Excel, Google Sheets, and LibreOffice all read correctly.