JSON to CSV Converter
Convert JSON arrays or objects into clean, downloadable CSV tables.
JSON to CSV
Move object records into rows and columns
JSON represents nested application data naturally; CSV represents a rectangular table. This JSON to CSV converter bridges those shapes by treating each array element as a row, collecting property names as columns, and escaping cell text when a delimiter, quote, or line break appears. A single root object is accepted too and becomes one row.
The conversion updates as the input or any option changes. Choose comma, semicolon, tab, or pipe separators, decide whether nested objects should be flattened into dot-separated columns, and include or omit the header row. Valid output can be copied or downloaded as converted.csv.
How rows and headers are built
After parsing, a root array becomes the source row list. A non-null root object is wrapped in a one-item array. Root strings, numbers, booleans, and null are rejected with Input must be a JSON array or a JSON object.
Each row is then processed. Object rows use their properties. If an array contains a primitive or null, that item becomes an object with one value column. This allows mixed arrays to produce output, although a consistent array of objects gives the most useful table.
Headers are the union of keys encountered across all processed rows, in first-seen order. A field that appears only in a later record still gets a column, and earlier records receive an empty cell there. Missing, undefined, and null values are all written as empty text, so those cases cannot be distinguished in the resulting CSV.
An empty root array produces no output and no error. An object with no keys cannot provide columns and reports No keys found to generate CSV columns.
Flatten nested JSON or keep it in cells
Flatten nested objects starts enabled. Nested non-array objects are recursively expanded using dots in column names:
{
"id": 7,
"customer": {
"name": "Mira",
"address": {
"city": "Pune"
}
}
}
This becomes columns id, customer.name, and customer.address.city. Arrays are not flattened. They remain a value and are serialized with JSON.stringify into one cell.
When flattening is disabled, top-level nested objects also remain within a cell as compact JSON. For spreadsheet analysis, flattened objects are usually easier to filter. Keeping objects intact can be preferable when downstream software understands JSON strings or when dotted property names would be ambiguous.
Dot flattening has an important collision risk. If one source record contains a literal key "customer.name" and also contains { "customer": { "name": ... } }, both target the same flattened header. The converter has no escaping or collision warning for such keys.
Complete conversion example
Input:
[
{
"id": 101,
"user": { "name": "Asha", "team": "Platform" },
"tags": ["on-call", "api"],
"note": "Handles, APIs"
},
{
"id": 102,
"user": { "name": "Leo", "team": "Data" },
"tags": ["etl"],
"enabled": true
}
]
With flattening and the header enabled, comma-delimited output is:
id,user.name,user.team,tags,note,enabled
101,Asha,Platform,"[""on-call"",""api""]","Handles, APIs",
102,Leo,Data,"[""etl""]",,true
The second record introduces enabled, so that column is added for both rows. The first row has an empty enabled cell; the second has an empty note cell. The comma in Handles, APIs requires quotes. Array JSON contains double quotes, so the field is wrapped and each internal quote is doubled.
Select the right delimiter
Comma (,) creates conventional CSV and is the default. Semicolon (;) can work better with spreadsheet locales where commas are decimal separators. Tab produces tab-separated values, often useful for direct pasting into a spreadsheet. Pipe (|) is convenient for simple data pipelines where commas and tabs are common inside values.
Escaping adapts to the chosen delimiter. A field containing a comma is not quoted in pipe mode unless it also contains a quote, carriage return, line feed, or pipe. This is deliberate: quoting is added when necessary for the selected format rather than to every field.
The downloaded file still uses the .csv extension and text/csv media type for all delimiter choices, including tabs and pipes. Some importers do not auto-detect non-comma separators, so select the delimiter explicitly during import.
CSV quoting rules used by the converter
Every header and value is converted to text. A field is enclosed in double quotes when it contains the active delimiter, a double quote, \n, or \r. Inside a quoted field, each " becomes "". Rows are separated by line-feed characters.
For example, the string:
She said "ship it", then left.
becomes this comma-delimited field:
"She said ""ship it"", then left."
Booleans become true or false; numbers use JavaScript string conversion. Null and missing fields become blank. Nested objects and arrays that remain as cells are compact JSON strings before CSV escaping is applied.
Use the converter effectively
Export an API result to a spreadsheet
Paste an array of similarly shaped records, keep flattening enabled, then download. Import the file with the same delimiter and UTF-8 encoding. If the API wraps records inside a property such as {"results": [...]}, extract the array first; a wrapper object becomes a single row rather than automatically selecting results.
Build a quick report
Convert audit events, inventory records, or test results into rows for sorting and filtering. Arrays within each event stay as JSON text, which preserves their content but does not create one row per array item.
Prepare data for a command-line pipeline
Pipe or tab delimiters can reduce quoting for data containing commas. Do not assume every Unix utility implements CSV quote parsing correctly; use a parser designed for the selected dialect when fields may include separators or newlines.
Inspect heterogeneous objects
Because headers are unioned, the output reveals optional fields across records. Empty cells show where a key was missing or null, but cannot tell those states apart.
Troubleshooting unexpected output
The converter rejects valid JSON
The JSON may be a valid primitive rather than an object or array. Wrap a value in an object, such as {"value": 12}, if you need one CSV row. Also check the displayed parser message for trailing commas, comments, or single quotes.
A nested array appears in one cell
That is expected. Flattening recurses through plain objects only. Arrays are serialized as compact JSON to avoid guessing whether they should create columns or duplicate rows.
Columns appear in an unexpected order
Headers follow first encounter across records and are not alphabetically sorted. Put a representative object first if column order matters, or reorder columns after conversion.
Null and missing values look identical
Both become empty fields. Encode a sentinel string in the source if the distinction must survive CSV conversion.
Spreadsheet software changes IDs or dates
The converter writes text but does not control spreadsheet type inference. Long numeric identifiers may display in scientific notation, leading zeros may disappear, and date-like strings may be reformatted. Configure import column types rather than opening the file with automatic detection.
The downloaded file does not split into columns
The importing application may expect a different delimiter. Select comma in the tool or specify semicolon, tab, or pipe in the import dialog.
Structural limitations
CSV has no universal way to represent nested objects, arrays, types, or null. This converter chooses dot flattening and JSON-in-cell encoding, but the process is not fully reversible. Dotted key collisions, empty-cell ambiguity, string/number ambiguity, and spreadsheet coercion can all lose information.
It does not transpose data, choose selected columns, rename headers, explode arrays, add a byte-order mark, stream large files, or implement a configurable newline convention. All rows and output are held in browser memory. For millions of records, use a streaming converter with explicit schema and dialect settings.
JSON to CSV FAQ
Can I convert one JSON object?
Yes. It becomes a one-row table. An array of objects becomes multiple rows.
Is the header optional?
Yes. Clear Include header row to output data rows only. Column order still follows the internally collected headers.
Which nested values are flattened?
Non-null objects are flattened recursively. Arrays and primitive values are not. Arrays become JSON strings in cells.
How are quotes escaped?
Fields needing quotes are enclosed in double quotes, and every internal double quote is doubled.
What filename is downloaded?
The browser download is named converted.csv, regardless of selected delimiter.
Does it follow RFC 4180 exactly?
It follows familiar field-quoting behavior but uses line-feed row separators and supports non-comma delimiters. Treat it as practical delimited text rather than a claim of strict conformance to every CSV dialect.
Can the conversion be reversed perfectly?
No. CSV does not retain JSON types or nesting unambiguously. Nulls and missing values both become empty, and nested arrays are stored as text.