How JSON Becomes CSV
Each object in a JSON array becomes one CSV row, and each key becomes a column header. Nested objects turn into columns such as address.city, and arrays are joined into a single cell. Paste your JSON above to get standard CSV you can copy or download for Excel, Google Sheets or a database import. The conversion runs entirely in your browser.
CSV is a flat table, so the converter does three things: it collects every key that appears in any row to build the header (in the order keys are first seen), flattens nested objects into dotted or underscored column names, and quotes any cell that contains the delimiter, a double quote or a line break. A single object converts to a one row CSV.
Worked Example: JSON In, CSV Out
Two records with a nested object, an array, a comma, quotes, a line break, a null and a missing key:
[
{"id": 1, "name": "Smith, Jane", "address": {"city": "Boston", "zip": "02134"},
"tags": ["vip", "east"], "note": "Said \"hi\"", "phone": null},
{"id": 2, "name": "Lee", "address": {"city": "Austin", "zip": "73301"},
"tags": [], "note": "Line one\nLine two"}
]
Output with the default settings (comma delimiter, dot notation, null as an empty cell):
id,name,address.city,address.zip,tags,note,phone 1,"Smith, Jane",Boston,02134,"vip, east","Said ""hi""", 2,Lee,Austin,73301,,"Line one Line two",
"Smith, Jane" is quoted because it contains the delimiter, the quotes around hi are doubled, and the note with a line break stays in one quoted cell. The second row has no phone key, so its cell is empty, exactly like the null in row one.
How Each Value Is Written
| JSON value | CSV cell | Note |
|---|---|---|
"Boston" | Boston | Quotes only when needed |
"Smith, Jane" | "Smith, Jane" | Contains the delimiter |
"Said \"hi\"" | "Said ""hi""" | Inner quotes doubled |
42, true | 42, true | Written as text |
null | (empty) | Or the word null with "Write null as text" |
| Missing key | (empty) | Header comes from other rows |
{"city": "Boston"} | column address.city | Or address_city, or skipped |
["vip", "east"] | vip, east | One cell |
["Smith, J", "Lee"] | "[""Smith, J"",""Lee""]" | Items with commas kept as JSON |
[{"sku": "A1"}] | "[{""sku"":""A1""}]" | Objects in arrays kept as JSON |
{} | (empty) | Column kept |
Opening the CSV in Excel and Google Sheets
- Accented letters look garbled: Excel on Windows guesses the encoding. The downloaded file starts with a UTF-8 byte order mark, which fixes this; if you paste the text into a file yourself, save it as "CSV UTF-8".
- Leading zeros disappear: ZIP codes like 02134 and IDs like 007 are read as numbers. Import with Data, From Text/CSV and set the column type to Text.
- Long numbers turn into 1.23457E+19: Excel keeps only 15 significant digits, so card numbers and long IDs are changed. Import those columns as Text as well.
- Columns do not split: in countries that use a decimal comma, Excel expects semicolons. Pick the semicolon delimiter above.
- Cells that start with =, +, − or @: spreadsheets may treat them as formulas. If the data comes from untrusted users, check those cells before opening the file.
Rows end with a line feed. RFC 4180 describes CR LF line endings, but Excel, Google Sheets, pandas and PostgreSQL's COPY all read either. To tidy or validate the JSON first, use the JSON formatter.
JSON to CSV Guide
[{"name":"Alice","age":30},{"name":"Bob","age":25}], each object becomes a row, keys become column headers. A single object: {"name":"Alice","age":30}, converted to a single-row CSV. Deeply nested objects are flattened using dot notation or underscores. Arrays are joined into one cell with a comma and a space, or kept as JSON text when they hold objects or values with commas. Inconsistent keys across rows are handled gracefully: missing values appear as empty cells.{"user":{"name":"Alice","city":"NY"}}, this tool flattens them into separate columns. With dot notation, this becomes two columns: user.name and user.city. With underscores: user_name and user_city. The "Skip nested" option omits nested objects entirely and only includes top-level primitive values. Arrays within objects (like {"tags":["a","b","c"]}) are joined into a single cell as a, b, c.""). Example: the value He said, "Hello" becomes "He said, ""Hello""" in CSV. The "Quote all fields" option wraps every field in double quotes regardless: useful when importing into strict parsers. Newlines within JSON string values are preserved as literal newlines within a quoted CSV field, which is valid per RFC 4180 but may not render correctly in all editors.import pandas as pd; df = pd.read_csv('file.csv'). For large files (100K+ rows), pandas or DuckDB will outperform Excel. For SQL databases: use COPY table FROM 'file.csv' CSV HEADER; in PostgreSQL.null values become empty cells by default. Tick "Write null as text" to write the word null instead, which helps when an empty string and a null must stay different. JSON false and 0 are valid values and are preserved. In Excel, empty cells and null cells look identical; in pandas, null appears as NaN.import csv, json; rows = list(csv.DictReader(open('file.csv'))); print(json.dumps(rows, indent=2)). In Node.js: use the csv-parse package. In the browser: use PapaParse (Papa.parse(csvString, {header: true})). Online tools like this site's JSON Formatter can help validate the resulting JSON. Note that type information is lost in CSV: all values come back as strings, so numbers and booleans need to be re-cast.jq -r '(.[0] | keys_unsorted) as $keys | $keys, (.[] | [.[$keys[]]] | @csv)' data.json (jq) or Python pandas: pd.read_json('data.json').to_csv('out.csv', index=False). These handle files with millions of rows efficiently.["a","b"] becomes a, b). Arrays that contain objects, or items that contain commas, are written as JSON text so nothing is lost. To give each array item its own row, reshape the data first, for example with jq or pandas json_normalize.