What the converter expects
JSON→CSV works best on the shape CSV was built for: an array of objects with consistent keys. The first object’s keys become the header row; each object becomes a data row. If your API wraps the data ({ "results": [ ... ] }), extract the array first. data.map is not a function is the classic error from handing the converter a wrapping object instead of the array inside it.
[ { "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" } ]
becomes a clean two-column, two-row CSV.
The comma-and-quote problem, handled
CSV’s fatal weakness is that its delimiter (the comma) frequently appears inside values, addresses, descriptions, lists. The RFC 4180 standard solves this with quoting, and the converter applies it automatically:
- A value containing a comma, quote, or newline is wrapped in double quotes.
- A literal double quote inside a value is escaped by doubling it (
"→"").
So Smith, John becomes "Smith, John" and He said "hi" becomes "He said ""hi""". This is why you should never split CSV on commas with a naive split(','): a compliant parser respects the quotes.
The UTF-8 / Excel encoding trap
Open a CSV with accented names or non-Latin text in Excel and you may see é where é should be. The file is correct UTF-8; Excel (especially on Windows) assumes a legacy locale encoding instead. Two reliable fixes:
| Fix | How |
|---|---|
| Import explicitly | Data → From Text/CSV → choose UTF-8 |
| Add a BOM | A UTF-8 byte-order mark tells Excel the encoding |
Google Sheets and modern tools handle UTF-8 correctly without this dance, the problem is specific to Excel’s import heuristics.
Going back: CSV to JSON and the type question
The reverse direction has one inherent limitation: CSV has no type system, so every value arrives as a string. "42", "true", and "2026-01-01" all come back as strings unless you post-process them. If your downstream code needs real numbers and booleans, add a typing pass after conversion, or, better, validate against a known schema so each field is coerced to its intended type deliberately rather than guessed.