HandyBench

JSON ⇄ CSV Converter

Convert between JSON and CSV both ways.

How to use the JSON ⇄ CSV Converter

  1. 1 Paste JSON (an array of objects) or CSV text.
  2. 2 Pick the conversion direction.
  3. 3 Download or copy the converted file.

How JSON becomes a flat table

CSV is a grid, and JSON is a tree, so the converter has to flatten. The JSON to CSV direction parses your input, treats a single object as a one-row list, and walks every object recursively. Nested keys are joined with dots, so {"address":{"city":"London"}} becomes a column called address.city. Arrays are not expanded into extra rows or columns. Each array is written into its cell as a JSON string.

The header row is the union of every key found in any record, in order of first appearance. A record that lacks a key, or holds null, gets an empty cell. A cell containing a comma, a double quote or a line feed is wrapped in double quotes, with inner quotes doubled, as RFC 4180 describes.

Worked example

[{"name":"Ada","address":{"city":"London","zip":"N1"},"tags":["math","code"],"note":"says \"hi\", twice"},
 {"name":"Grace","address":{"city":"NYC"},"extra":null}]

This produces:

name,address.city,address.zip,tags,note,extra
Ada,London,N1,"[""math"",""code""]","says ""hi"", twice",
Grace,NYC,,,,

Ada's array landed in one quoted cell, the quote inside her note was doubled, and Grace's missing fields are blank.

Limits of each direction

DirectionWhat to expect
JSON to CSVComma separator only. Numbers, booleans and null lose their type, because CSV has no types. A cell containing a comma, quote, line feed or carriage return is quoted. Output is saved as data.csv.
CSV to JSON (this page)A quote-aware parser with an auto-detected or chosen delimiter (comma, semicolon, tab or pipe). The first row is always the header, blank lines are skipped, and every value comes back as a string, so 36 becomes "36". Saved as data.json.

The CSV to JSON mode reads the text character by character, so quoted cells can hold commas, doubled quotes ("") and line breaks. Duplicate or empty header names are made unique (name, name_2, column_3), without clashing with a header that already exists (a,a,a_2 becomes a, a_3, a_2), and values beyond the header width get column_N keys instead of being dropped. A quote opens a quoted cell only at the start of a cell, so an inch mark inside a value stays a literal character. A quote that is never closed gives an error. When the JSON has just one column, empty values are written as "" so they are not mistaken for blank lines. For files without a header row or for compact output, use the dedicated CSV to JSON converter.

Common mistakes

  • Uneven records. If only the 500th object has a discount key, the column still appears, empty for the other 499 rows.
  • Nested arrays of objects. They are stringified, not split into rows. Flatten them to one record per row first if you need that.
  • Leading zeros and long numbers. Spreadsheets reinterpret 007 or a 16-digit ID as a number when you open the file. Import the column as text.
  • Invalid JSON. A trailing comma or single quotes fails the parse. Clean it with the JSON formatter first, and see the JSON formatting guide for the usual syntax traps.

Examples

  • ▸ Flattening [{"name":"Ada","address":{"city":"London"}}] into a CSV with the columns name and address.city.
  • ▸ Turning an API response array into a CSV you can open in Excel or Google Sheets.
  • ▸ Converting a semicolon-separated export, including a quoted cell with a line break, back into an array of JSON objects.

Frequently asked questions

What JSON shape converts cleanly to CSV?

An array of flat objects with consistent keys maps best. Nested objects are flattened using dot-notation column names, and a single object becomes a one-row table.

How are commas and quotes inside values handled?

Values containing commas, quotes or line breaks are wrapped in double quotes and internal quotes are doubled, following the standard CSV (RFC 4180) rules so they import cleanly into spreadsheets.

What happens to arrays inside my JSON?

Arrays are not split into extra rows or columns. Each array is written into its cell as a JSON string such as ["math","code"], so flatten it first if you need one value per row. If the result has only one column, an empty value is written as "" so the row is not mistaken for a blank line.

What if some objects have keys that others lack?

The header row is the union of all keys, in the order they first appear. Any record missing a key, or holding null, gets an empty cell in that column.

How good is the CSV to JSON direction on this page?

It uses a proper quote-aware parser. Quoted cells may contain commas, doubled quotes and line breaks, blank lines are skipped, and the delimiter (comma, semicolon, tab or pipe) is auto-detected or chosen from the dropdown. A quote only opens a quoted cell at the start of a cell, so 55" in the middle of a cell stays a literal character. The first row is always the header, repeated header names get a numeric suffix, and every value comes out as a string. For header-less files or compact output, use the dedicated CSV to JSON converter.

Is my data uploaded anywhere?

No. Conversion runs entirely in your browser, so the data you paste never leaves your device.

Related guides