JSON and CSV model data fundamentally differently
JSON objects are self-describing and flexible — each object in an array can technically have different keys, nested structures, or missing fields, and the format doesn't require any of that to be declared upfront. CSV is the opposite: a strict grid, where every row must have the same number of columns aligned under one shared header row. Converting from one to the other means reconciling that flexibility against that rigidity, and every real decision this tool makes — how the header gets built, what happens to a missing field, how nested data gets represented — is really about resolving that structural mismatch.
Building the header from inconsistent objects
The tool doesn't require every object in your JSON array to share identical keys. Instead, it walks through every object in order and builds the header as the union of all keys encountered, in first-appearance order — meaning the first time a new key shows up in any row, it gets added to the header at that point, and it stays in that position for every subsequent row. If a later row doesn't have a given key, that row's corresponding CSV cell is simply left empty rather than causing an error or misaligning the columns.
This approach means you don't need to pre-normalize your JSON array so every object has identical keys before converting — the header naturally accommodates whatever fields actually appear across the full dataset.
Converting your data
Paste a JSON array of objects into the input box — or try the built-in sample to see the expected shape.
Click Convert to CSV — keys are collected from every row in first-appearance order to build the header.
Inspect the output, then Copy it or Download as data.csv.
Cells containing commas, quotes, or newlines are wrapped and escaped automatically — no manual cleanup needed.
Why quoting and escaping follow RFC 4180 specifically
| Situation | What happens | Why |
|---|---|---|
| Cell contains a comma | Wrapped in double quotes | Prevents the comma from being read as a column separator |
| Cell contains a double quote | Quote is doubled ("") and the cell is wrapped in quotes | Distinguishes a literal quote character from the wrapping quotes |
| Cell contains a newline or carriage return | Wrapped in double quotes | Prevents the newline from being read as a new row |
| Cell has none of the above | Left unquoted | Keeps simple values clean and readable |
What actually happens to nested objects and arrays
Verifying your conversion looks right
Before relying on the output, check two things specifically: that the header row contains every field you expect (missing an expected column usually means that key never appeared in any row of your source JSON), and that any cell you know contains a comma, quote, or newline in the original data appears properly quoted in the output rather than accidentally breaking column alignment. Opening the downloaded CSV in a spreadsheet application is the fastest practical check — if columns look shifted or misaligned anywhere, that's usually a sign of unescaped special characters, though this tool's RFC 4180 handling should prevent that from happening in normal use.
Common mistakes
Assuming a top-level JSON object (rather than an array of objects) will convert — the required shape is specifically an array where each element is a plain object representing one row.
Expecting nested objects or arrays to expand into separate columns — they're preserved as serialized JSON strings within a single cell instead.
Manually pre-normalizing every object to have identical keys before converting — the tool already handles inconsistent key sets by building a union header and leaving missing fields blank.
Opening the CSV in software that doesn't correctly handle RFC 4180 quoting — most modern spreadsheet tools do, but older or custom CSV parsers occasionally don't handle embedded quotes and newlines correctly.
Real use cases
Exporting an API response's JSON array into a CSV file that non-technical colleagues can open directly in a spreadsheet.
Converting scraped or exported JSON data into a format compatible with tools that only accept CSV input.
Preparing JSON log data for analysis in spreadsheet software, preserving any nested fields as inspectable JSON text.
Quickly checking what a JSON dataset's actual field coverage looks like by seeing which columns appear in the generated header.
Frequently asked questions
Q: What JSON shape is required?
A: The top-level value must be an array of plain objects. Each object becomes a row, and the union of keys, in first-appearance order, becomes the header.
Q: How are special characters handled?
A: Any cell containing a comma, double quote, newline, or carriage return is wrapped in double quotes; embedded double quotes are escaped by doubling them (""), per RFC 4180.
Q: What happens to nested objects or arrays?
A: They're serialized as a JSON string within the cell, and quoted if that serialized string contains commas or quotes. This preserves the data so it can be parsed back later.
Q: Does it preserve key order?
A: Yes. The header is built by walking each row in order and adding any new keys encountered. If a row is missing a key, the corresponding cell is left empty.
Q: Is my data uploaded?
A: No. Parsing and CSV generation happen entirely in your browser, with zero network requests.
Q: Why does my CSV have more columns than I expected?
A: If different objects in your JSON array have different sets of keys, the header includes the union of all keys across every row — a field that only appears in one object out of a hundred still gets its own column, with empty cells for every row that lacks it.
Convert your JSON now
Try the JSON to CSV tool. Need to validate or pretty-print your JSON first? Use the JSON Formatter. Converting to a different structured format instead? Check the JSON ↔ YAML Converter, or extract specific fields with the Regex Tester.