How to Convert JSON to CSV Online with This Converter
Paste your JSON into the input box, or press Open .json file and pick a file from your device - the file is read locally in the tab and never uploaded. The moment the text parses, this json to csv converter builds the CSV in the result panel: a header row first, then one row per object. Conversion re-runs as you type, so editing the input updates the output without a page reload. When the result looks right, Copy CSV puts it on your clipboard and Download .csv saves it as converted.csv, ready to open in Excel, LibreOffice Calc, Google Sheets or any tool that imports CSV. The pills above the output always show the row count and column count, so you can sanity-check the shape of the result before you save it.
Four options shape the output. The delimiter picks the character between fields - comma by default, semicolon for European-locale spreadsheets, tab when the data itself is full of commas. Flatten nested objects decides whether a nested object becomes dotted columns such as user.name or stays as JSON text in one cell. The array separator is placed between the simple values of an array when they are joined into one cell. Null handling chooses between an empty cell and the literal word null. The array key field only matters for wrapped data holding arrays under more than one key. Set the options once, convert, and check the first few rows against your source before importing the file anywhere else.
How the Conversion Works: From JSON Values to Rows and Columns
Parsing comes first, and it is what separates a converter from a text trick. A regular expression cannot reliably split JSON, because commas and braces appear inside string values as easily as between them. The browser's built-in JSON parser reads the document properly: strings become strings, numbers become numbers, and structure becomes structure. Only after parsing does the converter walk the data. Each row object is flattened - with flattening on, nested objects open recursively so every leaf value ends up under one dotted name. The converter remembers every key it has seen, in first-seen order, and that list becomes the header. Each row is then written by looking up its value for every header key: present values are written as text, missing keys and nulls become empty cells (or the word null, if you chose that option), and every cell passes the RFC 4180 quoting check before it is joined with the delimiter.
That last step - the quoting check - is where naive converters quietly corrupt data. A value like x,y written bare into a comma-delimited file reads back as two fields, not one, and a value containing a quote mark breaks the field boundary entirely. This converter wraps any field containing the delimiter, a double quote or a line break in double quotes, and doubles every double quote inside it, exactly as RFC 4180 specifies. The output was verified by round-tripping it through a strict CSV parser during development: the parsed-back values matched the originals cell for cell, including values with commas, quotes and embedded line breaks.
The Three Input Shapes: Arrays, Single Objects and Wrapped Arrays
Most real-world JSON arrives in one of three shapes, and this converter accepts all three. The first and most common is a JSON array of objects - the shape of most API list responses and data exports. Each object becomes one row and each key becomes a column, which is why people describe the job as converting a json array to csv. The second shape is a single object: one record, converted to a header row and exactly one data row. That sounds trivial, but it is the shape of configuration objects, single-user profiles and one-off API detail responses, and many converters reject it for no good reason.
The third shape causes the most confusion elsewhere: an object containing an array. APIs love wrappers - a response like {"total": 2, "results": [...]} carries metadata beside the actual table. When the object holds an array under exactly one key, the converter uses it automatically and ignores the sibling metadata. When it holds arrays under two or more keys, guessing would be wrong half the time, so the converter stops and asks you to name the key in the Array key field. A lone number, string, boolean or null at the top level is rejected with a clear message, because it has neither rows nor columns.
A Worked Example, Checked Cell by Cell
Start with the smallest example that still exercises the quoting rules. The input is [{"a":1,"b":"x,y"},{"a":2,"b":"say \"hi\"","c":3}] - two objects, three distinct keys, one value containing a comma and one containing quote marks. Running exactly this input through this converter produces exactly this output:
| Line | CSV text | Why it looks that way |
|---|---|---|
| Header | a,b,c | The union of keys: a and b from the first object, c added by the second. |
| Row 1 | 1,"x,y", | The value x,y contains a comma, so it is quoted. There is no c in this row, so the last cell is empty. |
| Row 2 | 2,"say ""hi""",3 | The value contains quote marks, so the field is quoted and each inner quote is doubled. |
Read row 1 carefully, because it demonstrates the rule people most often get wrong by hand: the empty final cell is not a trailing decoration, it is the c column honestly reporting that the first object has no c. Delete it and every value in the row shifts one column left when the file is imported. Row 2 shows the doubled-quote rule from RFC 4180: inside a quoted field, two double quotes in a row mean one literal quote character. A strict parser reading this file returns exactly the values that went in - 1, x,y and an empty cell, then 2, say "hi" and 3 - which is the definition of a correct conversion.
The nesting example is just as small. The input [{"user":{"name":"Ana"}}] with flattening on produces one column headed user.name and one row containing Ana. With flattening off, the same input produces a column headed user whose cell holds the JSON text {"name":"Ana"}. Same data, two honest representations - the right choice depends on whether a person or a program will read the result.
JSON Types in CSV: The Mapping Table
CSV has exactly one data type: text. Every JSON value must therefore be translated into text, and the table below is the complete translation this converter performs - nothing else happens to your values, and nothing is reformatted, rounded or localised along the way.
| JSON type | Example value | CSV representation | Notes |
|---|---|---|---|
| String | "Ana" | Ana | Written exactly as-is; quoted only when it contains the delimiter, a quote or a line break. |
| Number | 42 or 3.14 | 42 or 3.14 | Plain decimal text. Very large integers are limited by JavaScript number precision, as in any browser tool. |
| Boolean | true | true | The words true and false, matching the JSON spelling. |
| Null | null | Empty cell (or the word null) | Your choice in the options. An empty cell is also what a missing key produces. |
| Object, flattening on | {"name":"Ana"} | Spread into dotted columns | user.name becomes its own column; the object itself never appears as a cell. |
| Object, flattening off | {"name":"Ana"} | {"name":"Ana"} as JSON text in one cell | Quoted under RFC 4180 because the text contains commas and quotes. |
| Array of simple values | ["a","b"] | a; b | Joined with your chosen separator - semicolon and space by default. |
| Array containing objects | [{"x":1}] | [{"x":1}] as JSON text in one cell | Joining objects would destroy them, so the array is kept whole as text. |
| Missing key | - | Empty cell | The column still exists because another row has the key. |
Two rows deserve emphasis. Numbers are written in plain decimal form, never with thousands separators or currency symbols - formatting belongs to the spreadsheet, not the data file. And an empty cell is information: it says this record has no value for this column, a different statement from zero, false or an empty string, even though a spreadsheet may display them all as blank.
Choosing a Delimiter: Comma, Semicolon or Tab
The delimiter is the character that separates one field from the next, and choosing the wrong one is the single most common reason a correct CSV file opens as one giant column. The right choice depends on where the file will be opened and what the data contains.
| Delimiter | File usually called | Choose it when | Watch out for |
|---|---|---|---|
| Comma , | .csv | Default for almost everything: databases, import tools, US and UK spreadsheet locales. | Values containing commas must be quoted - this converter does that automatically. |
| Semicolon ; | .csv | Excel in locales where the comma is the decimal mark, common across continental Europe. | If your array separator is also a semicolon, joined arrays and field boundaries can look alike. |
| Tab | .tsv or .txt | Values are full of commas and semicolons, or the receiving tool asks for tab-separated values. | Some tools trim or display tabs invisibly, making a quick visual check harder. |
Notice what quoting does to this decision: with RFC 4180 quoting, a comma inside a value is perfectly safe in a comma-delimited file, because the field is wrapped in quotes. The delimiter choice is therefore mostly about the receiving program's expectations. When in doubt, keep the comma - unless your spreadsheet opens comma files as a single column, the tell-tale sign of a semicolon locale.
Flattening Nested JSON and Handling Arrays Inside Rows
Real JSON nests. A user has an address, an order has line items, a product has attributes - and a spreadsheet has none of that, only rows and columns. Flattening is the bridge: with flatten nested json to csv enabled, the converter walks into every nested object and names each leaf value by its full dotted path. The object {"user":{"name":"Ana","address":{"city":"Lisbon"}}} becomes two columns, user.name and user.address.city, and the values land in an ordinary row. Dotted names are the convention most data tools use for exactly this job, they sort and filter well in a spreadsheet, and they keep the origin of every value visible in the header itself.
Flattening has honest limits. If two paths flatten to the same dotted name - a key literally called user.name beside a nested user object - the later value wins within that row, because a CSV header cannot hold two identical columns meaningfully. Deeply nested data also produces wide tables: fifty distinct leaf paths means fifty columns, most of them empty for most rows. That is not a converter defect; it is what the data looks like laid flat. Turning flattening off is the alternative: each nested object stays as JSON text in one cell, narrow and faithful, but opaque to spreadsheet formulas.
Arrays inside a row get the same honest treatment. An array of simple values - tags, sizes, categories - is genuinely one fact about the row, so it is joined into one cell with your separator. An array of objects is a table hiding inside a cell, and no separator trick preserves it, so it is written as JSON text where a program can still parse it later. If an inner array matters, convert it as its own CSV - the array key option exists partly for that.
Opening the Result in Excel and Other Spreadsheet Apps
The most common destination for a converted file is a spreadsheet, and the workflow people mean by json to excel csv is simple: convert here, download the .csv, and double-click it or import it. Excel, LibreOffice Calc and Google Sheets all read CSV natively, and all three understand RFC 4180 quoting, so values with commas, quotes and line breaks arrive intact. If Excel opens the file as one wide column, your copy of Excel expects semicolons - reconvert with the semicolon delimiter rather than fighting the import wizard. If long numbers arrive displayed in scientific notation or lose their final digits, that is Excel's own number handling, not the file: import the column as text when the values are identifiers rather than quantities.
One warning belongs in every guide of this kind: a spreadsheet is a place to look at data, and a risky place to keep it. Opening a CSV in Excel and pressing save can rewrite dates, strip leading zeros from codes and round long numbers, all silently. Keep the downloaded .csv as your original and work on a copy. The round-trip guarantee on this page covers the CSV file itself, verified against a strict parser - not any one program's import habits.
Invalid JSON and the Other Errors, Explained
When conversion fails, this page tells you why in plain words and produces no file - a half-converted download would be worse than none. The most common failure is invalid JSON: a trailing comma, single quotes, an unquoted key, a comment pasted in from a configuration file, or a response body truncated mid-stream. The converter shows the browser parser's own error message, including the character position when the browser reports one. Read the text at that position first; the actual mistake is usually at, or one token before, the reported spot, and a missing comma at the end of the previous line is the single most frequent culprit. The companion JSON Formatter can help you clean a document up before converting it.
The other messages are shape errors, and each names its own fix. An empty array has no rows. A lone top-level value has no keys to build a header from. An object holding arrays under several keys asks you to name the key you mean, because choosing silently would convert the wrong table half the time. A named key that is missing, or does not hold an array, says exactly that. None of these are dead ends, and the conversion re-runs as you type the moment the input is valid again.
Privacy First - and What CSV Honestly Cannot Keep
The conversion runs entirely in your browser tab. Nothing you paste is uploaded, transmitted or stored, and an opened .json file is read locally by the tab - it never leaves your device. That matters because the JSON people most often need as a spreadsheet is rarely public: customer exports, internal API responses, order histories, analytics payloads. Your values are also never rendered as page HTML; the output is placed into a plain text area, so markup inside a string value cannot execute. Closing the tab erases everything, so download the CSV first if you need to keep it - and remember that the downloaded file then lives wherever you put it, under your own care.
The limits, plainly. CSV cannot represent JSON losslessly. Nesting is flattened into dotted names or frozen as JSON text, arrays are joined or frozen the same way, and every value becomes text whose original type a reader can only guess. Duplicate flattened names collide, as the flattening section explains. Numbers are JavaScript numbers, so integers beyond the safe-integer range (above 2^53) may lose precision before conversion sees them; keep very large identifiers as strings in your JSON, as most APIs already do. Very large files may be slow: there is no artificial cap, but every row is flattened and every cell quoting-checked in the tab. This tool is a converter, not a database or an editor - it will not reshape, filter or join your data, and it makes no AI claims. What it does, it does exactly: faithful rows and columns, in your browser, for free.
Sources & References
- RFC 4180 - Common Format and MIME Type for Comma-Separated Values (CSV) Files - the memo that defines the CSV format this converter writes: header row, CRLF line breaks, and the quoting rules for fields containing commas, quotes or line breaks.
- RFC 8259 - The JavaScript Object Notation (JSON) Data Interchange Format - the IETF standard for JSON, defining its value types - object, array, string, number, boolean and null - that the mapping table on this page starts from.
- ECMA-404 - The JSON Data Interchange Syntax - the Ecma International standard defining JSON syntax independently of any programming language.
- MDN - JSON.parse() - how the browser parser used on this page turns JSON text into values, and the errors it throws on invalid input.
- MDN - JSON.stringify() - how values are turned back into JSON text, used here when a nested object or an array of objects is kept as JSON text inside one cell.
- Microsoft Support - Import or export text (.txt or .csv) files - Microsoft guidance on opening CSV files in Excel, including the locale behaviour behind the semicolon delimiter advice.
- Python documentation - csv module - a widely used CSV reader and writer implementation whose dialect rules, including quoting and delimiter handling, match the strict parser behaviour described on this page.