JSON to CSV: The Complete Guide (2026)
JSON is how programs talk to each other; CSV is how people open data in a spreadsheet. Converting between them is one of the most common small tasks in data work, and it has a few traps worth knowing. Here is the full picture, both directions.
JSON and CSV: two shapes for the same data
JSON and CSV both store tabular data, but they were built for different readers. JSON is hierarchical and self-describing: keys name every value, and structures can nest to any depth, which is exactly what code wants when it parses an API response. CSV is flat and minimal: a header row names the columns, and every row after it is a record, which is exactly what a spreadsheet wants. The two formats overlap on the simplest and most common case, a list of records that all share the same fields, and that overlap is where conversion is clean and lossless. The friction starts when JSON uses nesting that a flat grid cannot hold.
When to convert JSON to CSV
You convert JSON to CSV the moment a human needs to see the data in rows and columns. An API returns JSON, but your colleague wants to sort and filter it in Excel or Google Sheets. A logging system emits JSON, but the finance team needs a spreadsheet. An import tool, a CRM, or a billing system accepts CSV uploads but not raw JSON. In every case the job is the same: take an array of records and flatten it into a header row plus one row per record. Done right, the result opens in any spreadsheet on any machine with no special software.
When to convert CSV to JSON
The reverse is just as common. A non-technical teammate sends a spreadsheet, exported as CSV, and your code needs structured objects to work with. An API or a config file expects a JSON array, but the source of truth is a sheet someone maintains by hand. Converting CSV to JSON turns each row into an object keyed by the header, which is the shape JavaScript, Python, and almost every API speak natively. It saves you from hand-writing a brittle parser each time a CSV lands in your inbox.
Convert JSON to CSV and CSV to JSON, pick a delimiter, and download the result, all in your browser.
Open the JSON to CSV Converter →The structure that converts cleanly
The ideal input for JSON to CSV is an array of flat objects, where each object is a record and every key is a column. A good converter scans all the objects, builds the column header from the union of their keys, and leaves a cell blank when a record is missing a field. That means your records do not have to be perfectly uniform; one row can carry a field the others lack, and the conversion still works. A single object, rather than an array, becomes a one-row table. The trouble begins only when values are themselves objects or arrays, because a spreadsheet cell has nowhere to put a tree.
Delimiters and the Excel comma problem
CSV stands for comma-separated values, but the comma is not always the separator. Excel installed in many European locales uses the semicolon, because the comma is the decimal mark in those regions. This is the single most common reason a CSV "looks broken" when opened: every row lands in one column because Excel expected semicolons and got commas. The fix is to convert with the delimiter your spreadsheet expects. When in doubt, tab-separated output is the most robust choice, since tabs rarely appear inside data and paste cleanly into a sheet without any import dialog at all.
Quoting, escaping, and the round trip
CSV has exactly one rule that trips people up. If a value contains the delimiter, a double quote, or a line break, the whole field must be wrapped in double quotes, and any double quote inside it must be written twice. So the value Smith, John becomes "Smith, John", and she said "hi" becomes "she said ""hi""". A correct converter applies this automatically, and a correct parser reverses it, so a value survives a JSON to CSV to JSON round trip unchanged. A naive split on commas, by contrast, will shred any field that contains one. This is why a real parser beats a one-line script for anything but the most trivial data.
Nested data and its limits
The honest limit of any JSON-to-CSV conversion is nesting. A flat grid has no native way to represent an object inside a cell or an array of children. There are three common strategies, each a compromise. The simplest, and what this converter does, is to write the nested value as its JSON text into the cell, which keeps the data lossless even if it is not pretty. A second approach flattens nested keys into dotted column names like address.city. A third explodes arrays into multiple rows. Each loses something, whether readability, simplicity, or row integrity, so the right choice depends on what the receiving tool needs. If your data is deeply nested, consider reshaping the JSON to a flat array first.
Doing it in the browser versus the command line
Command-line tools like jq and small scripts can convert JSON and CSV, and they are the right call inside an automated pipeline. For a one-off conversion, though, a browser tool is faster and safer: there is nothing to install, no syntax to remember, and crucially, the data never leaves your machine, which matters when the file holds customer or financial records. A browser converter that runs entirely client-side gives you the convenience of an online tool without the privacy cost of uploading sensitive data to someone else's server. For validating the JSON before you convert it, pair the converter with a JSON formatter.
Frequently asked questions
What is the best JSON structure for converting to CSV?
An array of flat objects, where each object is a record and its keys are the columns. A good converter builds the header from the union of all keys and leaves missing fields blank, so records do not have to be perfectly uniform. Nested objects and arrays do not fit a flat grid cleanly.
Why does my CSV open as one column in Excel?
Excel in many European locales expects the semicolon as the separator because the comma is the decimal mark. If a comma-delimited file lands in one column, re-convert using a semicolon delimiter, or use tab-separated output, which pastes cleanly without an import dialog.
How are commas and quotes inside values handled?
Any value containing the delimiter, a double quote, or a line break is wrapped in double quotes, and inner quotes are doubled. A correct converter applies this automatically and a correct parser reverses it, so values survive a JSON to CSV to JSON round trip unchanged.
What happens to nested objects and arrays?
A flat CSV grid cannot hold a tree, so nested values are written as JSON text inside the cell, which keeps the data lossless. Alternatives are to flatten nested keys into dotted column names or to explode arrays into extra rows; each trades away something. Reshaping the JSON to a flat array first gives the cleanest result.
Is it safe to convert sensitive data online?
It is when the tool runs entirely in your browser. A client-side converter never uploads your data to a server, so customer and financial records stay on your machine. You can confirm this by checking that the browser network tab stays empty during conversion.
Should I use a browser tool or the command line?
For automated pipelines, command-line tools like jq are the right call. For a one-off conversion, a browser tool is faster and safer: nothing to install, no syntax to recall, and the data never leaves your device. Choose based on whether the task is repeated or one-time.
Keep reading
Written by SAVI. We build the tools we write about. Try the JSON to CSV Converter used in this post.