JSON to CSV Converter

In short: the sample converts to a CSV with columns name, role, score, team — note the "team" column appears even though only the second object has it, and the comma inside "Engineer, mathematician" is protected by quotes. Losing either behaviour is how converters quietly corrupt data.

The two decisions that make or break a conversion

JSON to CSV sounds mechanical until the data is imperfect, which is always. The first decision is columns. Real API responses are ragged: optional fields appear in some objects and not others. Taking the columns from the first object alone, as lazy converters do, silently deletes every key that first appears later; taking the union of all keys, as this page does, costs you some empty cells and loses nothing. The second decision is quoting. CSV's RFC 4180 rules exist because data contains commas, quotes and line breaks: wrap such fields in double quotes and double the inner quotes, and every serious parser (Excel, Sheets, pandas, database importers) reconstructs the original exactly. Skip it and the file still looks fine in a text editor, right up until a spreadsheet splits "Engineer, mathematician" into two columns and shifts the rest of the row.

Nested data is the honest limit of the format: a JSON value that is itself an object or array has no CSV representation, so this converter writes it as compact JSON text inside the cell, visibly and reversibly, rather than dropping it or exploding it into surprise columns. If your work needs full flattening with dotted keys, or pivoting arrays into rows, that is a transformation, not a conversion, and a script (jq, or ten lines of Python) is the right tool. Everything here runs locally in your browser; the download is generated on your machine.

Worked example

Input: the two-person array in the box above, where the second object adds a "team" key and the first role contains a comma.

Output:

name,role,score,team
Ada Lovelace,"Engineer, mathematician",98,
Alan Turing,Logician,95,Bletchley

Three things to notice: the union column "team" with an empty cell for Ada, the quoted role that keeps the row at four columns, and numbers written bare (98, not "98") so spreadsheets treat them as numbers.

Opening the CSV without wrecking it

The conversion is only half the journey; spreadsheets then reinterpret your data with great confidence. Excel strips leading zeros from anything that looks like a number (postal codes and product SKUs suffer first), converts long IDs into scientific notation, and cheerfully turns strings that resemble dates into dates: a gene named SEPT1 famously became a date in thousands of spreadsheets, and "1-2" rarely survives as text. The defences are to import rather than double-click (the import wizard lets you declare columns as text), or to accept that CSV is a transport format and do the typing in the destination system. Encoding is the other trap: this page downloads UTF-8, and Excel on Windows may open it as a legacy code page and mangle accented characters unless you import it and choose UTF-8 explicitly. If your data contains non-English text and your audience opens files by double-clicking, test the round trip once before sending a thousand rows.

Frequently asked questions

What JSON shape does this converter accept?

An array of objects is the natural input: each object becomes a row and the union of all keys becomes the columns, in the order keys first appear. A single object converts to a one-row CSV. Nested objects and arrays inside a value are written as compact JSON text in that cell (for example a tags array becomes the text ["a","b"]), because CSV has no nesting of its own; if you need nested data flattened into dotted columns, that is a job for a script with a tool like jq rather than a quick converter.

What if objects in the array have different keys?

Every distinct key becomes a column, and objects missing a key get an empty cell in that column. That union behaviour is the only honest choice: dropping keys that appear in later objects would silently lose data, which is what some converters do when they take columns from the first object only. If your CSV has many empty cells, the input data is genuinely ragged, and the spreadsheet is showing you something true about it.

How are commas, quotes and newlines handled?

By RFC 4180, the CSV standard: any field containing a comma, a double quote or a line break is wrapped in double quotes, and double quotes inside it are doubled. So the value: He said "hi", then left — becomes the cell "He said ""hi"", then left". Excel, Google Sheets and every serious CSV parser read this correctly. Converters that skip the quoting produce files that fall apart on exactly the rows with interesting data in them.

Why does my JSON show an error?

JSON is stricter than it looks. The usual causes: trailing commas after the last item (illegal in JSON, legal in JavaScript), single quotes instead of double, unquoted keys, comments, or a top-level value that is not an object or array of objects (a bare number or string has no columns to extract). The error message here includes the parser's position hint. If your data came from a JavaScript console, wrap it so keys are double-quoted, or export it with JSON.stringify, which always produces valid JSON.

Is my data uploaded anywhere?

No. The conversion runs entirely in your browser with JavaScript; nothing is sent to a server, which matters because JSON pasted into tools like this is often API responses containing names, emails or tokens. The download is generated locally as a file. That said, treat any online tool with suspicion by default and check for yourself: this page works with your network cable unplugged, which is the real test.

Note: very large inputs (tens of megabytes) may be slow in a browser tab; for those, a local script is the better tool. Everything runs locally; nothing is uploaded.

Related tools

Conversion rules and worked example last verified: 23 November 2026. Everything is calculated in your browser — nothing you type is sent anywhere.