JSON to CSV Converter — Export JSON Array to CSV Free
Convert a JSON array to CSV format using AI. Generates headers from keys, handles nested objects with dot notation, and escapes values correctly. Free, no sign-up.
Related Guides
JSON to CSV Converter — Export JSON Array to CSV Free
About JSON to CSV Converter — Export JSON Array to CSV Free
JSON to CSV converter transforms a JSON array of objects into comma-separated values format, mapping each object key to a column header and each object to a row. Developers use it to export API responses, database query results, and log data into spreadsheets or data pipelines that require tabular input.
JSON Type to CSV Output Mapping
| JSON Type | Example Input | CSV Output | Notes |
|---|---|---|---|
| String | "name": "Alice" | Alice | Quoted only if value contains comma, newline, or double-quote |
| Number | "age": 30 | 30 | Written as-is, no quotes |
| Boolean | "active": true | true | Lowercase string representation |
| null | "email": null | Empty field, no quotes | |
| Nested Object | "address": {"city": "NY"} | {"city":"NY"} | Serialized as escaped JSON string in one cell |
| Array | "tags": ["a","b"] | ["a","b"] | Serialized as escaped JSON string in one cell |
CSV Format vs Alternative Export Formats
| Format | Human Readable | Spreadsheet Support | Nested Data | File Size | Best For |
|---|---|---|---|---|---|
| CSV | Yes | Native (Excel, Sheets) | No (flattened) | Smallest | Flat tabular data, bulk imports |
| TSV | Yes | Good | No | Small | Tab-delimited pipelines, Unix tools |
| JSON | Yes | Plugin needed | Yes | Medium | APIs, config, nested structures |
| XLSX | No (binary) | Native | No | Larger | Excel-specific formatting, formulas |
| Parquet | No (binary) | Via tooling | Yes | Smallest compressed | Big data, analytics pipelines |
Frequently Asked Questions
How do I convert a JSON array to CSV in JavaScript?
Use Object.keys() on the first element to extract headers, then map each object's values in the same key order using Array.prototype.map(). Join each row with commas and rows with newlines. For production use, wrap values containing commas or quotes in double-quotes and escape internal double-quotes by doubling them (RFC 4180).
What happens to nested JSON objects when converting to CSV?
Nested objects and arrays cannot be represented natively in CSV since the format is strictly two-dimensional. Most converters either serialize nested values as a JSON string within a single cell, or flatten them using dot notation keys such as address.city. Choose flattening when you need the nested fields as separate queryable columns in your spreadsheet or database.
How do I handle JSON fields with commas or quotes in CSV output?
Per RFC 4180, any field containing a comma, double-quote, or newline must be enclosed in double-quotes. Any double-quote character within that field must be escaped by doubling it — for example the value She said "hi" becomes "She said ""hi""". Failing to follow this rule will break CSV parsers and corrupt column alignment.
Can I convert JSON to CSV if the objects have different keys?
Yes, but you need to collect the union of all keys across every object to build the header row. Objects missing a particular key should emit an empty field for that column. This is important when processing API responses or logs where fields are optional — always scan all records before writing the header.
What is the correct way to handle null and undefined values in JSON to CSV conversion?
JSON null should map to an empty field (two consecutive delimiters with nothing between them). The value undefined is not valid JSON, so it typically appears only when serializing JavaScript objects — treat it the same as null. Avoid outputting the string "null" as text unless your downstream tool explicitly expects it, since that makes the field non-empty and can break numeric type inference in tools like pandas or Excel.
If jsondecode.com saved you time, share it with your team
Free forever. No ads. No sign-up. Help other developers find it.