Convert a JSON Array to CSV for Excel
Choose the JSON file and keep comma separators, formula protection and the Excel UTF-8 marker enabled. Each object becomes one row, the union of its keys becomes the header, and the resulting CSV opens in Excel without uploading the source or treating untrusted text as a formula.
A JSON object, an array of objects, or an array of arrays up to 20 MB. It is parsed only in this tab.
Object keys become column headings in first-seen order, including keys that appear only in later records.
The UTF-8 marker helps older Excel versions recognise names and text outside basic ASCII correctly.
Formula protection prefixes risky text cells while leaving genuine JSON numbers and booleans as typed values.
How it works
How it is done
- Decode the file as UTF-8, discard a leading UTF-8 marker when present, and parse it with the browser's built-in JSON parser. Empty or syntactically invalid input is refused with the parser's reason.
- Decide the row model from the top level. One object is one row; an array of objects is many named rows; an array of arrays is many positional rows. Mixed row shapes are refused rather than guessed.
- For object rows, collect the union of keys in first-seen order so a field that appears only in a later record still gets one stable column and earlier rows get an empty cell there.
- When flattening is selected, walk nested objects into escaped dot paths such as profile.city. Keep arrays as JSON in one cell because their length is data, not a dependable set of columns.
- Render null or a missing field as an empty cell, booleans and numbers as JSON values, strings as text, and any remaining object or array as compact JSON.
- When formula protection is on, prefix string cells and headings whose first meaningful character is =, +, - or @ with an apostrophe. Real JSON numbers, including negative numbers, remain numeric.
- Double every quote inside a field and wrap a field in quotes when it contains the chosen separator, a quote or a line break. End every row with CRLF as the CSV convention specifies.
- Add the optional three-byte UTF-8 marker, encode the complete text, and offer .csv for comma or semicolon output or .tsv for tabs. Nothing is sent away at any point.
What it assumes
- Supported top-level shapes are one object, an array containing only objects, or an array containing only arrays. A primitive, an empty array or a mixture of row shapes has no unambiguous table and is refused.
- Object columns are the union of keys across every row, ordered by the first appearance of each key. Missing and null are both empty CSV cells because CSV has no distinct null value.
- Flattening descends through objects only. Arrays remain compact JSON in one cell; expanding list positions would let one unusually long row create thousands of columns and would pretend position means the same thing in every record.
- A literal dot or backslash inside a JSON key is escaped with a backslash before path segments are joined, so a key named profile.city cannot collide with the nested path profile then city.
- Formula protection applies only to JSON strings and column names. A typed JSON number such as -2 stays -2; the string "-2" is prefixed because a spreadsheet decides cell type from the CSV text.
- The UTF-8 marker is enabled by default for older Excel versions. It adds the three bytes EF BB BF and no row or column data; other spreadsheet and database tools normally tolerate it.
- Comma and semicolon output use the .csv extension. A tab separator uses .tsv and the text/tab-separated-values MIME type rather than labelling tabular data as comma-separated.
- Input is capped at 20 MB, at 500,000 rows and 5,000 columns. The rendered text is capped at 64 million characters so one expansion cannot exhaust the tab's memory.
Common questions
Why does the Excel-ready CSV begin with three invisible bytes?
They are the UTF-8 byte-order marker EF BB BF. They carry no table data; they tell versions of Excel that do not infer encoding reliably to decode names and other non-ASCII text as UTF-8.
Will every JSON object get the same Excel columns?
Yes. The header is the union of keys found across all records, in the order each key first appears. A record that lacks one of those keys gets an empty cell in that column.
Sources
The full method, worked example and every assumption behind this figure are on JSON to CSV Converter.