Skip to content
FmtTools

JSON to CSV Converter

Flatten an array of objects — or a nested API response — into a rectangular file with a column set you can defend, quoting that satisfies RFC 4180, and a warning list for everything a spreadsheet will do to it afterwards.

Delimiter

Nested keys

Array cells

Max depth

Maximum flatten depth

Quoting

Column order

Line ending

JSON input

Bytes 389Parses yes

CSV output

id,name,address.city,address.zip,tags,score,active,extra.nested.deep
1,Anne Ås,Oslo,0050,ops; admin,4.5,true,
2,"Li, Wei",Seattle,90210,ops,,false,value
9007199254740992,Gonzalo Ibáñez,Madrid,,,3.25,true,
Rows 3Columns 8Bytes 208

Wrote 3 record(s) × 8 column(s) — detected shape: array-of-objects

Nested paths flattened: 3Arrays joined: 3JSON-encoded cells: 0Quoting: only where requiredLine ending: LF

Column set

The union of every key found in the records, in the order the option produced. Keys present in only some records still become columns, so the grid stays rectangular.

  1. 1 id
  2. 2 name
  3. 3 address.city
  4. 4 address.zip
  5. 5 tags
  6. 6 score
  7. 7 active
  8. 8 extra.nested.deep

What this conversion had to decide

  • info2 of 3 records do not have exactly the 8 union columns.JSON allows every object to have different keys; CSV cannot. Missing keys become empty cells, which downstream readers may interpret as null or as an empty string.
Records
3
Columns
8
CSV bytes
208
JSON bytes
389
Nested paths
3

Flattened into composite headers

Arrays joined
3
JSON cells
0

Round-trips back exactly

Shape
array-of-objects

Every flattening decision is a column you have to explain

JSON is a tree; CSV is a grid, and there is no single correct projection between them. This tool makes the projection explicit. It accepts an array of objects, an array of arrays, a dictionary whose values are objects, or a single object, and reports the shape it detected before it commits to columns.

Nested objects become composite columns — address.city, address_city or address[city] — to a depth you set, and arrays are handled three ways: indexed columns, joined with a separator, or JSON-encoded into one cell. There is no universally right choice, so the tool states which one it took and how many cells were affected.

Ragged records are unioned rather than truncated: a key present in only one record still gets a column, and the count of records missing it is reported. On the way out, quoting is applied per RFC 4180 §2.6 — any field containing the delimiter, a quote or a line break is quoted, and internal quotes are doubled — plus the leading whitespace and formula-lookalike cases that a strict reading of the RFC leaves ambiguous.

Flattening, ordering and safety controls

  • Array, dictionary and single-object roots detected automatically
  • Dot, underscore, bracket or flattened column naming
  • Configurable depth with a report of paths beyond it
  • Array columns indexed, joined or JSON-encoded
  • Column order first-seen, alphabetical or deepest-first
  • Ragged key union with missing-value counts
  • RFC 4180 quoting, minimal or quote-everything
  • Optional UTF-8 BOM so Excel opens the file as Unicode
  • LF or CRLF line endings per RFC 4180 §2.1
  • Spreadsheet loss audit with per-cell fixes

How to convert JSON to CSV

  1. 1Paste the JSONThe most common input is an array of objects from an API page. If your payload wraps records in a field such as data.items, extract that array first with the JSON formatter outline, then paste it here.
  2. 2Set the flattening depth and array styleDepth 1 keeps one level of nesting as columns; deeper flattening produces wide files. Joining arrays with a separator is readable; JSON-encoding them is lossless and round-trips back.
  3. 3Decide quoting and BOM for your audienceQuote-everything is the safest for a file a human will open in Excel. The BOM is what stops a UTF-8 file full of accented names rendering as mojibake on Windows.
  4. 4Check the loss audit before you send itValues above 15 significant digits, date-like strings and formula-leading tokens are listed with the column and row. Those are the cells a spreadsheet will silently rewrite.

What happens to each JSON value shape

The default projection for every value type, and the alternative if the default does not suit.
JSON valueDefault CSV cellAlternative
"text"textQuote-everything mode wraps it in double quotes.
4242Keep as text with a leading apostrophe when a consumer must not retype it.
nullempty cellA literal NULL token for database loads.
["a","b"]a,bIndexed columns tags.0, tags.1, or JSON in one cell.
{"city":"Oslo"}address.city columnJSON-encoded single cell when the shape is unstable.
90071992547409939007199254740993Reported as spreadsheet risk: Excel will store 9007199254740990.

The audit row for the last case is the reason this tool prints fixes rather than only warnings: the loss happens in the application that opens the file, not in the conversion.

Frequently asked questions

How do I flatten nested JSON to CSV?

Set the flattening depth to cover the levels you want as columns and choose a separator — address.city reads well in a header row, an underscore style survives tools that treat dots as path syntax. Anything deeper than the limit is reported instead of silently dropped.

Why are my columns in a strange order?

By default columns appear in first-seen order, which follows your data rather than alphabet. Records that omit a key still contribute to the union, so a column can exist with mostly empty cells; that is reported as a missing count.

Can it handle an array of arrays?

Yes — a header row is synthesised as column_1…column_n unless you supply keys, and the shape report says so. Array-of-arrays input is common from spreadsheet copies and database exports.

Why does the CSV need a BOM for Excel?

Without one, Excel on Windows guesses the code page and non-ASCII characters break. The BOM is not part of RFC 4180, and strict parsers must strip it, which is why it is an option rather than the default.

Will opening the CSV in Excel corrupt my data?

Potentially, and the audit tells you which cells. The documented behaviours are a 15-significant-digit ceiling, scientific-notation conversion, date reinterpretation of strings like 2024-1-5, and formula execution for values starting with =, +, - or @ — see CSV vs Excel.

Can I get the JSON back out of the CSV?

Round-trip is exact for JSON-encoded array cells and lossy for joined ones, because a separator inside a value becomes indistinguishable. The CSV to JSON converter reports column typing so you can see what survived.

What happens to the structures CSV cannot hold?

Nothing is dropped quietly. Nested objects become one column per leaf path, with the separator style under your control; arrays are either JSON-encoded into the cell, joined with a delimiter, or expanded by index, and the report counts which strategy each cell got. Ragged records contribute a union of every key rather than vanishing, with the sparse-row count stated, and the Excel audit then lists the cells a spreadsheet is likely to reinterpret — long numerics, formula-looking strings, date-shaped text — before you open the download.