From hierarchy to flat table
JSON and CSV solve different problems. JSON is great for hierarchical data: objects within objects, lists, nullable values. CSV is flat by definition: every row has the same fields, no depth. Converting JSON to CSV means accepting a controlled loss of structure — nestings get flattened or serialized as strings.
What this converter expects
The input must be an array of objects, each object representing a row. Keys in the first object define CSV columns (headers). If a later object has a key the first one didn't, it's left out. If it's missing a key, that cell stays empty. For very heterogeneous datasets, normalize first with a script that guarantees the same keys across all records.
The RFC 4180 standard
- Each row ends with CRLF (most parsers accept LF too).
- If a field contains the separator, wrap it in double quotes.
- If a field contains double quotes, double them:
"she said ""hello""". - If a field contains line breaks, wrap it in quotes too.
- The first record can be a header row (recommended).
Separators: comma, semicolon, tab
Although CSV stands for "comma-separated values," in practice the separator depends on context. In countries where the comma is the decimal separator (Spain, Germany), Excel defaults to semicolon to avoid clashes. If your CSV will open in a Spanish Excel, use ;. If you're processing with pandas or loading into a database, comma is standard. TSV (tab-separated) is the safest option when content has lots of commas.
Common use cases
- Moving API data to Excel. A stakeholder asks for the month's orders; pull the API query as JSON, convert to CSV, open in Sheets.
- Loading data into tools that don't read JSON. Mailchimp, HubSpot, Salesforce and many others prefer CSV imports.
- Human-readable backup. A CSV from your database is easier to audit by eye than a giant JSON dump.
- Analysis with pandas or R. Both read JSON, but the native CSV functions are faster.
Limitations to know
- Nested values (objects, arrays) get serialized as JSON in the cell. If your consumer doesn't expect that, it'll read literal text instead of structure.
- Types are lost: everything is a string in CSV. A JSON
truebecomes the string"true". - Date format depends on the source. If JSON stored ISO strings (
2026-04-26T10:00:00Z), they pass through as strings. - Column order is set by the first object. To pin a specific order, sort the keys before exporting.
Productivity tips
If you'll open the CSV in Excel and have non-ASCII characters (accents, ñ), save with a UTF-8 BOM at the start so Excel detects the encoding. For database imports, consider | (pipe) as separator in datasets with many commas and quotes — it simplifies manual parsing dramatically.