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
| Direction | What to expect |
|---|---|
| JSON to CSV | Comma 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
discountkey, 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
007or 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.