Fix JSON to CSV Conversion Errors
Resolve JSON to CSV conversion issues: nested object handling, array flattening, special character escaping, encoding problems, and missing columns.
Converting JSON to CSV seems simple until you hit nested objects, arrays, special characters, or inconsistent schemas. This guide covers every common conversion error.
Common errors covered
Nested objects produce [object Object] in CSV
CSV column shows [object Object] instead of data
Nested JSON data missing from CSV output
CSV is a flat format. When a JSON field contains an object, naive conversion just calls toString() which produces [object Object].
Step-by-step fix
- 1 Use our JSON to CSV tool - it automatically flattens nested objects.
-
2
Nested keys become dot-notation columns:
address.city,address.zip. - 3 Or flatten manually before conversion.
- 4 For deeply nested data, consider JSON Lines format instead of CSV.
{"name": "Alice", "address": {"city": "NYC"}}
-> CSV: name,address
Alice,[object Object]
{"name": "Alice", "address": {"city": "NYC"}}
-> CSV: name,address.city
Alice,NYC
Commas in values break CSV columns
CSV columns are shifted/misaligned
Importing CSV shows data in wrong columns
If a value contains a comma and is not properly quoted, the comma is interpreted as a column delimiter.
Step-by-step fix
- 1 Our JSON to CSV tool automatically quotes values containing commas.
- 2 Check that all values with commas are wrapped in double quotes.
-
3
If a value contains double quotes AND commas, the quotes must be escaped:
"". - 4 Verify by opening the CSV in a text editor (not Excel) to see raw formatting.
name,address Alice,123 Main St, Apt 4 // 'Apt 4' becomes a separate column!
name,address Alice,"123 Main St, Apt 4" // Quoted value keeps comma as data
Inconsistent JSON keys produce missing CSV columns
Some rows have empty/missing columns in CSV
CSV header does not match all data rows
When JSON objects in an array have different keys, CSV conversion must handle the superset of all keys. Missing keys become empty cells.
Step-by-step fix
- 1 Use our JSON to CSV tool - it collects all unique keys across all objects.
- 2 Check that the header row contains all expected columns.
- 3 Missing values become empty cells (this is correct CSV behavior).
- 4 If keys are inconsistent, normalize your JSON schema before conversion.
[{"name": "Alice", "age": 30}, {"name": "Bob", "email": "[email protected]"}]
// Which columns should the CSV have?
[{"name": "Alice", "age": 30}, {"name": "Bob", "email": "[email protected]"}]
-> CSV: name,age,email
Alice,30,
Bob,,[email protected]
Prevention Tips
- Flatten nested JSON before CSV conversion when possible.
- Always use our JSON to CSV tool which handles quoting, escaping, and nesting automatically.
- For complex JSON structures, consider alternative formats: TSV, JSON Lines, or Parquet.
- Validate the CSV output by importing it back and checking row/column counts.
Frequently Asked Questions
How should JSON arrays inside values be handled in CSV?
Arrays can be joined with a delimiter (e.g., tag1|tag2|tag3), JSON-stringified in the cell, or split into separate rows. Our tool joins arrays with a pipe | by default.
Why does Excel show garbled characters when opening my CSV?
Excel defaults to the system encoding, not UTF-8. Add a BOM (Byte Order Mark) at the start of the file, or import via Data then From Text/CSV and select UTF-8 encoding.
Can I convert CSV back to JSON?
Yes. Our JSON to CSV tool supports bidirectional conversion. The first row becomes JSON keys.
Related Error Guides
Related Tools
Still stuck? Try our free tools
All tools run in your browser, no signup required.