Quick answer (TL;DR)Free JSON to CSV converter. Paste a JSON array of flat or nested objects. Choose comma, tab, or pipe delimiter. Download or copy the CSV. Browser-only.
About JSON to CSV conversion
JSON to CSV conversion turns an array of objects (the standard REST API response format) into a flat tabular CSV that Excel, Google Sheets, Pandas, or your database loader can ingest. This converter runs entirely in the browser, auto-flattens nested keys with dot notation, and quotes fields per RFC 4180.
The two formats solve different problems. JSON is hierarchical and self-describing, ideal for APIs and config files where records can nest and vary. CSV is flat and rectangular, the lingua franca of spreadsheets, databases, and statistical tools that expect rows and columns. The conversion is therefore lossy in one direction: a tree must be flattened into a grid, which is why nested objects collapse into dot-notation headers and arrays get serialised into a single cell. Understanding that trade-off is the key to getting clean output, because it tells you exactly where structure will be flattened and where you may need to re-explode the data downstream.
How it works
The converter walks the array, flattens nested objects into dot-notation columns, takes the union of all keys as the header set, and escapes each cell per the standard CSV grammar.
flatten(obj, prefix) for nested objects headers = union of all keys across all rows for each row: write headers.map(h => escape(row[h])).join(delimiter) escape(v): wrap in "..." and double internal " if v contains delimiter, quote, or newline (RFC 4180)
- Delimiter: comma is the default RFC 4180; tab (TSV) is more robust for prose with commas; semicolon is required for many European Excel locales; pipe is common in legacy data exchange.
- Nested objects:
{user:{address:{city:"NYC"}}}becomes column headeruser.address.city. - Arrays inside objects: serialized with
JSON.stringifyso they fit one cell. Use a downstream parser to re-explode if needed. - Missing keys: empty cells. The header set guarantees a rectangular table.
Worked example
Three objects with one nested field and one missing key:
- Input:
[{"name":"Alice","age":30,"city":"NYC"},{"name":"Bob","age":25,"city":"LA"},{"name":"Charlie","age":42}]. - Flatten: already flat. Headers = {name, age, city}.
- Header row:
name,age,city. - Row 1:
Alice,30,NYC. - Row 2:
Bob,25,LA. - Row 3:
Charlie,42,(missing city becomes empty cell). - If a name contained a comma like
Doe, John, the output cell is wrapped:"Doe, John".
read_csv(), PostgreSQL COPY, and Google Sheets Import CSV with no further escaping.Now add nesting: if Alice's record were {"name":"Alice","address":{"city":"NYC","zip":"10001"}}, the flattener would emit two columns, address.city and address.zip, with values NYC and 10001. A list field such as "tags":["vip","beta"] would not split into columns; it is JSON-stringified into one cell as the literal text ["vip","beta"], ready to be re-parsed later if your pipeline needs the individual tags. This is the union-of-keys rule doing its job: every record contributes its flattened keys to one shared, rectangular header set.
Delimiter quick reference
| Delimiter | Extension | Best for | Watch out |
|---|---|---|---|
| Comma (,) | .csv | RFC 4180 default, most tools | Quoting needed for prose |
| Tab (\t) | .tsv | Prose, names with commas | Hidden in many editors |
| Semicolon (;) | .csv | European Excel locales | US Excel may need wizard |
| Pipe (|) | .psv | Legacy / financial feeds | Rare in BI tools |
Common mistakes
- Not quoting embedded delimiters. A name like Smith, John with a comma delimiter will split into two columns unless wrapped in double quotes per RFC 4180.
- Forgetting the UTF-8 BOM for Excel. Windows Excel reads CSV in the system codepage by default. Non-ASCII characters (accents, CJK, emoji) appear mojibake unless the file starts with
EF BB BF. - Treating leading zeros as numbers. ZIP codes, phone numbers, and product codes lose leading zeros when Excel auto-converts. Either prefix with
'or use TSV plus text-import wizard. - Mismatching schemas between rows. The converter takes the union of all keys. Verify the expected columns are present after a flatten of deeply nested API responses.
- Putting commas inside numbers. Some locales write
1,234.56; CSV with comma delimiter splits this into two cells. Strip the thousands separator or switch to TSV before export. - Pasting from word processors. Smart quotes from Word break
JSON.parse. Paste into a plain-text editor first or strip with a regex.
Related tools and glossary
Frequently asked questions
How are nested objects flattened?
Dot notation. The key user.address.city in JSON becomes a single CSV column header user.address.city. Arrays inside objects are JSON.stringified into the cell, so ["a","b"] appears as the literal text ["a","b"] rather than splitting across columns.
How are special characters escaped?
Per RFC 4180. Fields containing the delimiter, double quotes, or newlines are wrapped in double quotes. Embedded double quotes are doubled, so a value of John "JD" Doe is written as "John ""JD"" Doe". This matches what Excel, Google Sheets, and Pandas read.csv() expect.
Why does my CSV look wrong in Excel?
Excel auto-detects the delimiter based on system locale. In many European locales it expects semicolon, not comma. Switch the delimiter selector to semicolon (or save as .tsv) and Excel opens it cleanly. UTF-8 BOM may also be required for non-ASCII characters in Excel.
What happens with mixed schemas across rows?
The converter takes the union of all keys across all rows as the header set. Rows missing a key get an empty cell for that column. This guarantees a rectangular CSV from heterogeneous JSON objects without losing data.
Sources
- IETF RFC 4180 (2005) Common Format and MIME Type for Comma-Separated Values (CSV) Files.
- ECMA-404 (2017) The JSON Data Interchange Standard.
- Microsoft (2024) Open or save a workbook in a file format, Excel CSV import behavior.
- Pandas docs (2025) read_csv with quoting and escapechar.
