JSON ↔ CSV Converter

Bidirectional converter between JSON arrays and CSV. Handles nested objects (flattens with dot notation), arbitrary delimiters, custom headers, and automatic type coercion (numbers/booleans). Powered by Papa Parse. UTF-8 BOM added on download so Excel reads accented characters correctly.

Developer Tools
ProDentim Sponsored

JSON → CSV: column inference

When converting a JSON array of objects to CSV, the tool collects every unique key across all rows and uses them as columns. Missing values in any row become empty cells. This handles "ragged" JSON arrays where different objects have different fields — you don't have to pre-normalize the data.

Nested objects get flattened with dot notation when the "flatten" option is on: {user: {name: "Alice"}} becomes a column named user.name. Arrays of primitives become JSON-encoded strings in their cell ("[1,2,3]"). Arrays of objects can't be flattened sensibly; they're also JSON-encoded as strings.

CSV → JSON: type coercion

CSV is untyped — every cell is a string. With the "parse numbers/booleans" option enabled, the tool tries to detect actual types: 42 becomes the number 42, 3.14 becomes the number 3.14, true/false become booleans, empty cells become null. Strings with leading zeros (007), phone numbers (+1234567890), and anything ambiguous stays as a string to avoid data loss.

If you need every cell as a string regardless (for round-trip safety, or because your downstream parser does its own coercion), turn off the option. The output will be an array of objects where every value is a string.

CSV escaping rules — what most tutorials get wrong

CSV looks simple but has subtle rules (RFC 4180):

  • Fields containing the delimiter, a newline, or a quote must be wrapped in double quotes. Smith, John as a single cell is written "Smith, John".
  • Double quotes inside a quoted field are escaped by doubling them. She said "hi" becomes "She said ""hi""".
  • Newlines are valid inside quoted fields. A cell value can span multiple lines if the whole thing is inside quotes. Naive line-by-line CSV parsers break here.
  • No leading or trailing spaces are stripped automatically. "Alice", "Bob" has values Alice and Bob (with leading space). Some parsers do strip; others don't. Be deliberate.

This tool uses Papa Parse, the most battle-tested JavaScript CSV library, which handles all these correctly. Hand-rolled split(',') CSV parsers break on any of the cases above — never write your own.

Excel and the BOM gotcha

Excel on Windows interprets UTF-8 CSV files correctly only if they start with a UTF-8 BOM (byte-order mark, 0xEF 0xBB 0xBF). Without it, Excel treats UTF-8 as Windows-1252 and accented characters appear garbled (é becomes é). The fix: prepend the BOM when generating CSV files that will be opened in Excel.

When you click Download, this tool adds the BOM automatically. If you copy the text out and save it manually, you may need to prepend the BOM yourself or use "Save as UTF-8" in your editor.

ProDentim Sponsored

Common use cases

Frequently asked questions

How is nested JSON handled?

With "flatten" enabled, <code>{user: {name: "Alice"}}</code> becomes a column named <code>user.name</code>. With it disabled, nested objects get JSON-encoded as strings in their cell. Arrays are always JSON-encoded as strings — flattening arrays of objects loses correspondence.

What about CSV files that use semicolons or tabs?

Pick your delimiter from the dropdown — comma, semicolon, tab, or pipe. Semicolons are common in European locales (where comma is the decimal separator). Tabs are used by TSV files.

Why is type coercion only optional?

Coercion is useful for numbers and booleans but loses information for some strings: <code>007</code> (leading zeros), <code>+12345</code> (phone numbers), <code>"true"</code> (literal string vs boolean). With coercion off, every value is a string — safe for round-trips but harder to use directly.

Excel shows weird characters when I open the downloaded CSV.

Excel on Windows interprets UTF-8 as Windows-1252 unless the file starts with a UTF-8 BOM (byte-order mark). This tool prepends the BOM automatically when you click Download. If you copy the text out and save manually, you may need to prepend the BOM yourself or save with "UTF-8 with BOM" encoding.

Is there a row limit?

Functionally no — the limit is your browser's memory. Files with hundreds of thousands of rows work but become sluggish to render in the textarea. For million-row datasets, use Papa Parse directly in Node or a command-line tool like <code>jq</code> + <code>csvkit</code>.

Related tools