Data · Converters

JSON to CSV Converter

Turn an array of JSON objects into comma-separated CSV on your device—headers from keys, nested values kept as JSON text in cells.

What is JSON to CSV Converter?

A JSON to CSV converter flattens JSON records into delimited text for Excel, Google Sheets, or any row-and-column tool. The usual input is an array of objects; each object becomes one row, and keys become headers.

This The ToolSphere converter runs in your browser. Paste JSON, convert, then copy or download a .csv file. Your payload is not uploaded to The ToolSphere servers for conversion.

CSV dialects vary across products. This generator always uses a comma delimiter, quotes fields when needed, and doubles embedded quotes. Nested objects and arrays are stringified into a single cell so the table stays rectangular.

Why Use This Tool?

Use it when API samples or app exports arrive as JSON and you need a spreadsheet for review or handoff—without writing a throwaway script for every dump.

Nested values become JSON text inside a cell, so you keep recoverable structure while still opening a grid in Sheets or Excel. That trade-off is intentional for this browser tool.

  • Export API-shaped arrays into spreadsheet-friendly CSV
  • Union headers across rows so sparse objects still align
  • Keep nested values as JSON strings instead of dropping them
  • Convert sensitive payloads on your machine

How Does This Tool Work?

The page parses your text with the browser’s JSON.parse. Valid input must be an array or a single object. A lone object becomes a one-row table. An array of primitives (strings, numbers, booleans, null) wraps each item as { "value": item } so every row still has a column.

Header order is the order keys are first seen while scanning rows from top to bottom. Later rows that introduce new keys append those columns. Missing keys in a given row become empty cells.

Each cell is written with comma separation. A cell is wrapped in double quotes if it contains a comma, a double quote, or a CR/LF. Inside quoted cells, each " becomes "". Null and undefined become empty fields. Objects and arrays are passed through JSON.stringify before that escaping step.

  • Output lines use LF (\n) between rows, including the header line
  • The on-page converter always emits comma-separated CSV (delimiter is not configurable in the UI)
  • Invalid JSON shows an error and no CSV until the input parses
  • An empty array yields an empty string (no header line)

Understanding Your Results

Confirm quoting in a text editor if needed. Spreadsheet apps may reinterpret numbers, leading zeros, and dates—that is their behavior, not this converter changing values.

A cell like {"city":"Austin"} means a nested object was stringified on purpose. CSV to JSON will treat that cell as one string unless you parse nested JSON yourself. Column order follows first-seen keys across rows.

  • Booleans and numbers become text forms (true, 12); quotes appear only when escaping requires them
  • Unicode from JSON is written through as text—open the file as UTF-8 in your spreadsheet
  • Keep values JSON-serializable; circular structures fail at stringify time

Why Tracking This Matters

JSON preserves types and nesting; CSV maximizes grid interoperability. Knowing nested data collapses into strings prevents false expectations. Header unioning keeps optional fields from sparse API dumps aligned so you can sort and filter in a sheet.

Benefits of Using JSON to CSV Converter

  • Accepts an array of objects or a single object
  • Wraps non-object array items under a value column
  • Builds headers from the union of keys across rows
  • Quotes fields that contain commas, quotes, or line breaks
  • Stringifies nested objects and arrays instead of omitting them
  • Empty cells for null, undefined, or missing keys
  • Copy or download in the browser; pairs with CSV to JSON

How Is the Result Calculated?

Generation is a deterministic mapping from parsed JSON to delimited text:

headers = ordered union of Object.keys(row); each row → escape(cell).join(",")

Input
JSON array or object. Other top-level types are rejected with an error.
Header union
Keys collected in first-seen order across rows; missing keys yield blank cells.
escape(cell)
String form of the value (JSON.stringify for objects/arrays); wrap in quotes and double internal quotes when the value contains ,, ", CR, or LF.
Delimiter
Comma in the shipped UI. The underlying helper can accept other delimiters, but this page always uses comma.
  • null and undefined → empty field (no literal null text)
  • Empty array → empty output string
  • Line endings in output → LF only

Tips for Better Results

  • Prefer an array of flat objects for the cleanest spreadsheets.
  • Normalize key order in JSON if column order matters to stakeholders.
  • Flatten nested data in code first if you need separate columns.
  • Fix JSON parse errors with a formatter before converting.
  • Open downloads as UTF-8 in Excel if international characters look wrong.
  • Import numeric-looking IDs as text when leading zeros matter.
  • Use CSV to JSON to see how a flat table returns as string maps.

Standards and References

Conclusion

Use JSON to CSV when you need a rectangular, comma-separated export from an array of objects—or a single object—without leaving the browser. Nested values stay visible as JSON text in cells, and headers expand to cover sparse keys.

For the opposite direction, convert with CSV to JSON and expect string-valued flat objects. That pairing is enough for many review and prototyping workflows.

Privacy & how it works

This converter runs in your browser. Your files and text are not uploaded to The ToolSphere servers for this tool. Privacy Policy.

FAQ

How is this different from CSV to JSON?expand_more

This page writes CSV from parsed JSON. CSV to JSON reads delimited text and emits an array of string-keyed objects. Use JSON to CSV for API dumps and formatter output; use CSV to JSON for spreadsheet exports.

What JSON shape works best?expand_more

An array of objects with flat string or number fields. A single object becomes one data row. Nested objects are allowed but land as JSON text inside one cell.

What if my array contains strings or numbers?expand_more

Each non-object item becomes a row with a single value column holding that item.

How are nested objects handled?expand_more

They are JSON.stringify’d into the cell, then CSV-escaped if needed. Columns are not auto-expanded.

Can I choose semicolon or tab output?expand_more

Not in this UI. The page always writes comma-separated values. You can replace delimiters afterward if another tool requires them.

How are null values exported?expand_more

Null and undefined become empty cells, not the words null or undefined.

Does column order follow my JSON?expand_more

Headers follow the order keys are first encountered while scanning rows from the start of the array.

Is this the same as RFC 4180 CSV?expand_more

The quoting rules (quote fields with commas/quotes/newlines; escape quotes by doubling) align with the common RFC 4180 style for comma-separated files. CSV still has no single universal standard across all software.

Will Excel treat my IDs as numbers?expand_more

Possibly. Spreadsheet software may coerce numeric-looking text. Import as text or prefix carefully if leading zeros matter.

Is my JSON uploaded?expand_more

No for this tool. Conversion runs in your browser.

What error means “JSON must be an array of objects or a single object”?expand_more

The top-level value was something else after parsing (for example a bare string or number). Wrap records in an array or object.

Can I round-trip with CSV to JSON?expand_more

Flat string fields round-trip cleanly as strings. Nested values that were stringified come back as strings, not automatic nested objects.

Suggest an improvement

Tell us what would make this tool more useful. We read every suggestion.

Feedback for: JSON to CSV Converter