JSON to CSV
JSON to CSV requires a top-level array whose every item is a non-null object. It builds headers from the first-seen union of top-level keys, writes missing values as empty cells, and quotes data cells containing commas, quotes, or line breaks. Header names are joined without CSV escaping, nested objects become [object Object], arrays become comma-joined strings, and types are reduced to text.
Runs locally — files stay on your deviceAre nested JSON objects expanded into columns?
No. Only top-level keys become columns.
Tabular conversion needs a flattening and type policy
CSV cells are strings arranged under headers; JSON can contain nested objects, arrays, booleans, null, and typed distinctions that have no automatic tabular equivalent.
How it works
The array is parsed, unique top-level keys become headers, values pass through a CSV cell escaper, and rows are joined with commas and line breaks.
Key concepts
Union of keys
Later-only properties add columns after earlier keys.
String coercion
Objects and arrays are not structurally preserved.
When to use it
- Export a flat array of records.
- Create a simple spreadsheet handoff.
- Inspect consistent top-level object fields.
When not to use it
- Do not convert nested records without defining a flattening policy.
- Do not rely on header escaping for commas or quotes.
- Do not expect JSON types to survive a CSV round trip.
Worked examples
Flat records
- Input
[{"id":1},{"id":2}]- Expected output
id\n1\n2
One header is created.
Missing field
- Input
[{"a":1},{"b":2}]- Expected output
a,b rows with blanks
The header union is used.
Nested object
- Input
[{"x":{"a":1}}]- Expected output
x\n[object Object]
No flattening occurs.
Common mistakes
Nested conversion
Structure collapses to generic text. Correction: Flatten with an explicit schema first.
Problematic header
Comma-bearing keys are not quoted. Correction: Use a schema-controlled export library.
Expecting typed import
CSV carries text cells. Correction: Publish a schema alongside it.
Best practices
- Use flat homogeneous objects.
- Control and sanitize header names.
- Test the destination parser and encoding.
Related operations and differences
CSV to JSON
Choose CSV to JSON when you need to convert a header-based CSV table to JSON.; use JSON to CSV specifically for json to csv.
CSV to TSV
Choose CSV to TSV when you need to convert comma-separated data to tab-separated data.; use JSON to CSV specifically for json to csv.
JSON to XML
Choose JSON to XML when you need to convert JSON objects into formatted XML.; use JSON to CSV specifically for json to csv.
JSON to YAML
Choose JSON to YAML when you need to convert JSON data into readable YAML.; use JSON to CSV specifically for json to csv.
TSV to CSV
Choose TSV to CSV when you need to convert tab-separated data to CSV.; use JSON to CSV specifically for json to csv.
XML to JSON
Choose XML to JSON when you need to convert XML elements and attributes into JSON.; use JSON to CSV specifically for json to csv.
Limitations and privacy
- Top-level array of objects only.
- No nested flattening, header escaping, delimiter option, schema, type preservation, streaming, BOM, download, or formula-injection defense.
The pasted data is parsed and transformed locally in this browser.
Frequently asked questions
How is column order chosen?
By first appearance of keys across records.
Are missing values blank?
Yes.
Are nested objects supported?
They are coerced to text, not expanded.
Are dangerous spreadsheet formulas neutralized?
No.