🔁

JSON to CSV

✓ Free & no signup 🔒 Runs 100% in your browser Updated 2026-11-25 Development Tools

Analytics teams live in spreadsheets, APIs emit arrays of objects, and getting from the second to the first is a weekly chore: open the JSON, squint at inconsistent keys, flatten something by hand, and hope the quoting survives the trip into Excel. This converter automates exactly that move. Paste an array of JSON objects, get CSV with every column properly quoted and every key from every row collected into the header — even when the rows disagree about which fields they carry.

That last part is the feature most converters skip. Real API data is ragged: a signup export where early rows lack plan, later rows lack referral_code, and one row carries a coupon nobody else has. A converter that derives columns from only the first row silently loses fields. This one scans every object and unions all keys across the whole array, so each field lands in its own column, and rows that lack a field simply leave that cell empty.

Everything runs locally in the browser — no upload, no account — which matters here more than usual, because the arrays people convert are exports of users, orders, and payments: exactly the data you should not be pasting into unknown servers.

How the Conversion Works

The pipeline is three steps. First, the input is parsed as JSON; if it fails, you get the syntax error with its line and column rather than a mangled file. Second, every key across every object is collected into one ordered set — this becomes the header row, preserving the order in which keys first appear. Third, each object is written as one CSV row, with a cell for every header column, empty where the object lacked the key.

A worked example with ragged keys. This three-object array:

  • [ { "email": "ana@example.com", "plan": "pro", "mrr": 49 }, { "email": "bo@example.com", "trial": true }, { "email": "cy@example.com", "plan": "free", "referral_code": "BOGO2026" } ]

produces this CSV structure: the header is email,plan,mrr,trial,referral_code — four keys beyond what the first row alone would have revealed. The first row reads ana@example.com,pro,49,, with empties for the fields Ana lacks; Bo's row carries trial as true and empties elsewhere; Cy's row fills referral_code. Three objects with three different key sets, one coherent table, zero dropped fields.

The Quoting Rules, Precisely

CSV quoting is where conversions quietly corrupt data, so the rules are applied strictly, following the standard Excel and RFC-4180 conventions:

  • A cell containing a comma, a double quote, or a line break is wrapped in double quotes.
  • A double quote inside a cell is escaped by doubling it: the value He said "go" serializes as "He said ""go""".
  • A cell containing a line break stays one cell in Excel precisely because the quotes protect it — a review comment spanning two lines remains one review.
  • Simple cells like 49 or ana@example.com are written bare, so the file stays readable and diffs cleanly.

The consequences are concrete. Export 200 support tickets whose comment fields contain commas, quotes, and multi-line text, and every ticket opens in Excel with its comment intact in the right cell — versus the naive converter's output where row 3's comment has leaked into columns G through K and every row below is shifted. Misaligned spreadsheets are not an inconvenience; they are wrong numbers in a report.

How to Use It (Step by Step)

  1. Paste your JSON array of objects into the input area. Nested objects in values are serialized compactly into their single cell rather than breaking the row.
  2. Check the generated header: it is the union of all keys, ordered by first appearance, which usually matches your mental model of the data.
  3. Use copy to grab the CSV text, or download it as a .csv file that Excel, Google Sheets, and Numbers all open directly.
  4. In the spreadsheet, verify the row count equals your array length and spot-check one tricky row — the one with the longest text field — for correct alignment.
  5. If the input is a single object rather than an array, it converts as a one-row table, which is handy for flattening a config into a reviewable sheet.

Spreadsheet-Ready: What That Actually Requires

Opening a CSV in Excel is easy; opening one correctly is not, and three properties separate a usable file from a corrupted one. Column alignment: every row must have exactly as many cells as the header, which the empty-cell rule guarantees. Quoting fidelity: commas and quotes inside values must be escaped, per the rules above, or the row structure collapses. Type survival: numbers written bare — 49, 12.5 — are recognized by Excel as numbers immediately, so sorting and formulas work without a text-to-columns rescue.

The recurring scenarios where this pays off: a PM exporting user signups from an internal admin API into a pivot table; a finance person pulling transaction objects into a reconciliation sheet; an engineer generating test fixtures as spreadsheets a non-technical teammate can edit and hand back. In each, the union-of-keys behavior is what makes the file complete, and strict quoting is what makes it survive Excel's parser.

JSON vs CSV: What Each Side Expects

The formats encode different assumptions, and knowing them prevents surprise. CSV is one flat table: a single record type, one header, no nesting. JSON objects nest freely, so a deeply nested input flattens awkwardly — a nested address object serializes as a compact JSON string inside one cell, which is faithful but not sortable. If you need city and zip as separate columns, flatten your JSON upstream so the keys exist at the top level. The table sums up the mapping:

JSON inputCSV outputNote
Array of flat objectsIdeal tableThe case this tool is built for
Ragged keys across rowsUnion header, empty cellsNothing dropped
Nested object valueCompact JSON string in one cellFlatten upstream for real columns
Array valueCompact JSON string in one cellSame rule

Tips and Best Practices

  • Flatten nesting before converting: map address.address1 to address1 in your script, and every downstream spreadsheet gets real columns.
  • Keep keys clean — unique, lowercase, no spaces — so the header row is immediately usable in formulas and imports.
  • Standardize nulls: use consistent empty strings or omit the key entirely, since either way the cell ends up empty but mixed conventions confuse analysis.
  • Convert dates to ISO strings in the JSON first; Excel parses them reliably, while locale formats sometimes masquerade as text.
  • For arrays of arrays or deeply mixed structures, extract the record list you actually need before pasting; one conversion should carry one record type.

Frequently Asked Questions

How do I convert a JSON array to CSV?
Paste the array of objects into the converter. It parses the JSON, collects every key from every object into one header row, and writes each object as a CSV row beneath it. Copy the result or download it as a .csv file that Excel and Google Sheets open directly. The conversion runs in your browser with no upload, so exports containing user or payment data stay on your machine. If the input is invalid JSON, you get the syntax error's line and column rather than a silently mangled file.
What happens when my JSON objects have different keys?
The header becomes the union of all keys across all rows, ordered by first appearance, and each row fills the columns it has while leaving the rest empty. An array where one object has a coupon field nobody else does still gets its coupon column, and the other rows simply show empty cells there. This ragged-key handling is the main reason conversions stop dropping fields silently — a converter that reads only the first object would never know the later keys existed.
How are commas and quotes inside values handled?
By the standard CSV quoting rules. Any cell containing a comma, double quote, or line break is wrapped in double quotes, and quotes inside the value are doubled — He said "go" serializes as "He said ""go""". Line breaks inside a quoted cell stay inside one cell when opened in Excel, so multi-line comments do not shatter the row structure. These are the same conventions Excel and RFC-4180 use, which is why the output opens with every value in the correct column instead of shifted by stray characters.
Why does my nested JSON become a JSON string inside one CSV cell?
CSV is a flat format: one header, one record type, no nesting. A nested object or array inside a row has no columns to expand into, so it serializes as compact JSON text inside its single cell — faithful to the data but not sortable or filterable. If you need real columns for nested fields like address.city, flatten them upstream: map nested keys to top-level names in your script before converting. One flat object per record is the shape CSV handles perfectly, and a minute of flattening saves rebuilding the spreadsheet by hand.
Will numbers open correctly in Excel after conversion?
Yes, when they are written bare — plain numeric values like 49 or 12.5 go into the CSV unquoted, and Excel recognizes them as numbers immediately, so sorting, sums, and pivot tables work without cleanup. Values that arrive as JSON strings stay quoted or text-like, which is correct: a string "49" and a number 49 are different data, and the converter preserves that distinction rather than guessing. For columns you want numeric in the sheet, make sure they are actual numbers in the JSON rather than quoted strings.
Is there a size limit for JSON-to-CSV conversion?
No hard limit — the ceiling is your browser's memory and rendering, and the conversion runs entirely locally. Arrays of a few thousand objects convert in well under a second on a typical laptop; tens of thousands still work with a brief pause. Very large exports, hundreds of thousands of rows, are better handled by command-line tools, since the browser holds the JSON, the key union, and the CSV string in memory at once. For anything you would paste into a spreadsheet anyway, this tool comfortably covers the size range that matters.

Related Tools