200 tools

Code & JSON Tools · · 4 min read

How to Convert JSON to CSV (and Flatten Nested Objects)

Turn a JSON array of objects into CSV with the JSON to CSV tool — flatten nested fields, pick a delimiter, and handle commas and quotes correctly.

To convert JSON to CSV, paste a JSON array of objects into the JSON to CSV tool — it builds a header row from every key it finds, flattens nested objects into parent.child columns by default, and quotes any value that contains a comma, quote or line break.

What the JSON to CSV tool does

Most JSON-to-CSV converters choke the moment a record has a nested object or a field another record doesn't have. This one handles both: it scans every object in the array first to build one shared set of columns (in the order keys first appear), so rows with different fields still line up under the right headers, and empty cells fill in for whatever's missing. Nested objects can be flattened into dotted column names like address.city, or left alone and dropped into the cell as raw JSON — your choice.

How to convert JSON to CSV with Toolbench

  1. Open the JSON to CSV tool.
  2. Paste your JSON into the input box. A single object works too — it's treated as a one-row array.
  3. Leave Header row on to get a column header from every key, or turn it off for data-only output.
  4. Leave Flatten nested objects (a.b) on to turn nested objects into dotted columns (address.city), or turn it off to keep each nested object as a single JSON-string cell.
  5. Pick a Delimiter — Comma, Semicolon, or Pipe.
  6. Read the CSV in the output box and click Copy, or use ↑ Use as input to send it on to another transform.

Example: array of objects

With Header row and Flatten on and Comma as the delimiter, this input:

[{"name":"Ana","role":"Designer"},{"name":"Bo","role":"Engineer"}]

produces:

name,role
Ana,Designer
Bo,Engineer

Example: flattening nested objects and mismatched keys

Records don't need identical shapes. Given:

[
  {"name":"Ana","role":"Designer","address":{"city":"Austin","zip":"78701"}},
  {"name":"Bo, Jr.","role":"Engineer","notes":"Say \"hi\""}
]

with Flatten on, the tool collects every column across both rows and flattens the nested address object into two columns:

name,role,address.city,address.zip,notes
Ana,Designer,Austin,78701,
"Bo, Jr.",Engineer,,,"Say ""hi"""

Ana's row has no notes, and Bo's row has no address, so the gaps become empty cells. Notice "Bo, Jr." gets wrapped in quotes because the name itself contains a comma, and the embedded "hi" becomes ""hi"" — doubled quotes are the standard CSV way to escape a quote inside a quoted field.

Turn Flatten off and the same input keeps address as one column holding the nested object as a JSON string instead of splitting it into address.city / address.zip:

name,role,address,notes
Ana,Designer,"{""city"":""Austin"",""zip"":""78701""}",
"Bo, Jr.",Engineer,,"Say ""hi"""

Reference: options

Option Default What it does
Header row On Adds a first row of column names; off outputs data rows only
Flatten nested objects (a.b) On Nested objects become dotted columns; off keeps them as a JSON-string cell
Delimiter Comma Comma, Semicolon, or Pipe between fields

Tips and common mistakes

  • A value is only quoted when it needs to be. The tool wraps a cell in quotes only if it contains the chosen delimiter, a double quote, or a line break — plain values like Designer or 78701 are left bare.
  • Arrays inside a field aren't flattened. Flattening only recurses into plain nested objects; an array value (or an object that's itself an array) is stringified as JSON in its cell either way.
  • Missing keys become empty cells, not shifted columns. Because the tool builds one column list from every row first, a record missing a field just gets a blank in that column instead of throwing off the alignment.
  • Need tab-separated instead? Use JSON to TSV rather than picking a delimiter here — it's a dedicated tool with a fixed tab separator.
  • CSV to JSON — convert the other direction, from CSV rows back into a JSON array.
  • JSON Formatter — validate, pretty-print, minify and sort keys before you convert.
  • JSON Viewer & Editor — explore nested JSON as a collapsible tree and copy field paths.
  • JSON to XML — convert the same JSON into well-formed XML instead.

Frequently asked questions

Does JSON to CSV work with a single JSON object, not just an array?

Yes. A single object is treated as a one-row array, so it still produces a header row and one data row.

What happens to nested objects if I turn off flattening?

Each nested object is kept as one cell containing its JSON string (for example {"city":"Austin","zip":"78701"}), instead of being split into separate parent.child columns.

How are commas and quotes inside values handled?

Any cell containing the chosen delimiter, a double quote, or a line break is wrapped in quotes, and any double quote inside it is doubled (" becomes "") — standard CSV escaping.

Can I convert to a delimiter other than comma?

Yes — the Delimiter option also offers Semicolon and Pipe. For tab-separated output, use the dedicated JSON to TSV tool instead.

Is my JSON sent to a server to convert it?

No. The conversion happens entirely in your browser. Signed-out visitors have nothing saved; if you're signed in, your input syncs privately to your account.

More guides

All guides →