JSON to CSV Converter
Turn JSON object records into CSV rows while keeping nested values explicit.
Accepts one JSON object or an array made only of objects. Column order follows the first appearance of each property name.
CSV output
Converted CSV rows will appear here.
A CSV row needs a flatter model than JSON
JSON can nest objects and arrays at any property. A CSV row cannot. Here, top-level object properties become columns and nested arrays or objects become compact JSON text inside a single cell. That keeps their content visible without inventing a flattening path convention or unexpectedly multiplying rows.
When records have different properties, the header is the union of property names in first-seen order. A property that does not exist in a record becomes an empty cell. An explicit JSON null becomes the text null. The two cases remain visually distinguishable, though CSV itself carries no type metadata.
CSV escaping applies to headers too
Property names can contain commas, quotes, or line breaks just like values. Every header and cell is therefore passed through the same CSV escaping rule: fields that need quoting are enclosed in double quotes and embedded quotes are doubled. Output records use CRLF line endings, matching the common form documented by RFC 4180.
CSV quoting is not spreadsheet sanitization
A quoted CSV field can still be interpreted as a formula after a spreadsheet opens it. The optional apostrophe prefix is a defensive export choice for formula-like text; it is deliberately opt-in because it changes the original string.
JSON numbers pass through JavaScript
Before conversion, duplicate object member names and numbers that exceed a conservative JavaScript precision boundary are stopped. Otherwise parsing could discard one duplicate member or round a value before CSV serialization. Quote precision-sensitive identifiers in the source JSON when exact digits matter more than numeric typing.
What a nested record looks like in CSV
JSON
{"name":"Sneha","tags":["api","data"]}
CSV
name,tags
Sneha,"[""api"",""data""]"The array remains one cell containing valid compact JSON text. A later CSV importer will still see it as text unless that application explicitly parses the cell as JSON.
Round trips are inherently lossy
- CSV does not distinguish strings, booleans, numbers, nulls, and dates by itself.
- Nested containers are serialized into text rather than reconstructed as table structure.
- Missing properties and empty strings can both produce visually empty cells.
- Spreadsheet formula protection changes formula-like string values when enabled.
Two specifications worth keeping separate
RFC 8259 defines JSON's interoperable data model and discusses duplicate names and number limits. The separateRFC 4180 documents a common CSV form and the text/csv media type. CSV implementations vary, so the RFC is a useful baseline rather than a universal spreadsheet contract.
