JSON to CSV Converter
Paste a JSON array of objects on the left, get a properly-quoted CSV on the right. Header row from object keys, runs locally — no upload.
- Paste a JSON array of objects into the left textarea.
- Click "Convert to CSV". Header row is built from the union of object keys.
- Copy the result, or download as data.csv.
- For nested values, the field is JSON-stringified — flatten beforehand if you want flat columns.
What does it do?
Converts a JSON array of objects to RFC 4180 CSV. The header row is the union of all keys across objects. Values are CSV-quoted when they contain commas, quotes, or newlines. Numbers and booleans are emitted unquoted; null and undefined become empty fields. Nested values (objects, arrays) are JSON-stringified into a single quoted field — CSV cannot natively represent hierarchy.
Example
JSON input:
[
{"name":"Ada","age":36,"role":"engineer"},
{"name":"Grace","age":40,"role":"scientist"}
] CSV output:
name,age,role
Ada,36,engineer
Grace,40,scientist Common JSON-to-CSV pitfalls
CSV is a flat format. Most "weird" output comes from JSON shapes that do not have a flat representation.
- Top-level not an array. A JSON object `{"a":1,"b":2}` cannot become CSV directly — wrap it in an array: `[{"a":1,"b":2}]`. The CSV will have one header row and one data row.
- Heterogeneous keys across rows. If the first object has keys `{a,b}` and the second has `{a,c}`, the header is `a,b,c` (the union). Rows missing a key emit an empty field. Pre-process if you want a stricter schema.
- Nested values silently flattened. A field like `{"address":{"city":"NY"}}` becomes a single CSV column whose value is the JSON string `{"city":"NY"}`. To get separate `address.city` columns, flatten in JavaScript first: `{address_city: row.address.city}`.
- Embedded newlines in values. A multi-line string in a JSON value becomes a quoted CSV field with literal `\n` characters inside the quotes. Most spreadsheet apps handle this correctly; some legacy tools do not.
- Special characters in headers. JSON keys with commas, quotes, or newlines work but produce a header row that some CSV consumers parse poorly. Rename keys to alphanumerics + underscore before converting if you need maximum compatibility.
- Trailing comma in JSON. `[{"a":1},]` is invalid JSON (trailing comma after the last element). The parser rejects it before the CSV step. Most JSON formatters strip these — run through `/json-prettifier` first if needed.
Frequently asked questions
How do I get tab-separated output (TSV)?
This page emits comma-separated CSV. To get TSV, paste the resulting CSV into a text editor and replace `,` with `\t`. Or run PapaParse with `delimiter: "\t"` on the command line — same library.
Will key order be preserved in the header row?
Yes — the header row uses the order in which keys first appear across all objects. If you want alphabetical order, sort the keys in your JSON before pasting.
How are dates handled?
JSON has no native Date type — dates are typically already serialized as ISO 8601 strings. Those pass through unchanged. If your JSON contains a Date object via JSON.stringify, it has already been converted to an ISO string at that point.
Can I round-trip JSON → CSV → JSON?
For flat array-of-flat-objects data, yes. Strings stay strings, numbers stay numbers (with PapaParse dynamic typing on import). Nested values lose structure on the CSV side and round-trip as JSON-string fields, not as nested objects again.
Is my JSON uploaded?
No. Everything runs in your browser — your JSON is parsed and converted by JavaScript on this page and never sent to any server. Verify in the browser developer tools.
How big a JSON file can I convert?
Up to about 50 MB before the browser textarea starts to feel slow. The conversion itself scales linearly with input size; the bottleneck is rendering. For larger files, run PapaParse on the command line.