JSON to CSV Converter
Convert a JSON array of objects into CSV — columns are the union of all keys, missing values stay blank, and rows use CRLF line endings per RFC 4180.
Paste your JSON
How it works
- Parses the input and requires a JSON array at the top level
- Walks every element and collects the union of all keys in first-appearance order as the header row
- Serializes each value: null and undefined become empty cells, objects and arrays become JSON strings, and strings containing commas, quotes or newlines are wrapped in double quotes with inner quotes doubled (
"") - Joins rows with CRLF (
\r\n) line endings and appends a trailing newline, per RFC 4180
About JSON to CSV Converter
A JSON array of objects and a CSV table describe the same shape: each element is a row, each key is a column, and the value fills the cell. Converting between the two lets you move data out of APIs and scripts and into spreadsheets, or hand tabular data to tools that only speak CSV.
Reach for this tool when you need to export data to Excel or Google Sheets, or migrate records between systems. A few caveats: nested objects and arrays are serialized as JSON strings inside the cell rather than flattened; columns are the union of all keys in first-appearance order, so elements with missing keys simply leave those cells blank; and null or undefined values become empty cells — a null and an empty string look identical after conversion.
Column order comes from first appearance, not from a schema
Every element is walked in order and each unseen key is appended to a running column list, so the header is the union of all keys in first-appearance order. That is deterministic — the same input always yields the same header, which matters for diffs and checksums — but a key appearing only in the last record becomes the last column, after a run of empty cells, rather than sorted next to its siblings. There is no type inference and no schema: column widths do not exist in CSV, so a number and its stringified form are indistinguishable once written.
Each row is emitted by looking up every column in that object, so a row missing a key produces an empty cell in that position rather than shifting the remaining values left. Positional integrity holds even when the input objects have different shapes, which is what makes the union approach safe here.
Cell serialisation and the quoting rule
Four cases, in order: `null` and `undefined` both become an empty cell; objects and arrays become `JSON.stringify` output; everything else is stringified and quoted only if it contains a comma, double quote, carriage return or newline, with inner quotes doubled. Nesting therefore produces a quoted cell containing escaped JSON, which is exactly what the `RFC 4180` escaping rule is for. Note that leading and trailing spaces are not in that trigger set, so ` padded ` is written bare — legal and tolerated by mainstream parsers, but not preserved by the strictest readers.
Rows are joined with `\r\n` and a trailing `\r\n` appended, the line ending RFC 4180 requires and what Excel expects. A newline inside a value is emitted as a bare `\n` because that is what the JSON string contained, so a multi-line value inside a quoted field carries lone line feeds rather than CRLF — readable by any conforming parser, though not byte-identical to a strict exporter's output.
The two ways this output can hurt you
A JSON `null`, a missing key, and an empty string all land in the cell as nothing at all. Once written, those three states are indistinguishable, and the CSV cannot be inverted without guessing. If the distinction matters — and it usually does, since `null` and `""` mean different things to a database import — normalise it before converting.
The other hazard is that nothing here neutralises a leading `=`, `+`, `-` or `@`. Those four characters are the ones Excel, LibreOffice and Google Sheets treat as the start of a formula when importing CSV, so a value like `=1+1` is executed rather than displayed, and `@SUM(...)` or a DDE payload in a file that a colleague opens becomes code running with their privileges. Prefixing the cell with a single quote is the standard mitigation. This tool emits the value as given, which is the right default for a converter and the wrong default for untrusted input.
Frequently Asked Questions
How do I convert JSON to CSV?
What if my JSON objects have different keys?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.