JSON to CSV Converter
Convert JSON arrays to CSV format with custom delimiters.
Reviewed by Aygul Dovletova · Last reviewed
How to Use the JSON to CSV Converter
- Paste a JSON array of objects into the input pane. Each object becomes one CSV row. Arrays of primitives alone will not convert - the top level must be an array whose items are objects.
- Pick a delimiter: comma (the default), semicolon (common in European locales), or tab for TSV output.
- Toggle the header row. Keep it on for most cases. Turn it off when appending to an existing CSV that already has a header.
- Click Convert. Values that contain the delimiter, a quote, or a newline are automatically wrapped in double quotes per RFC 4180. Copy the output or download it as a
.csvor.tsvfile.
How the Conversion Works
The converter runs JSON.parse first, which guarantees well-formed input and converts duplicate keys into the last-one-wins value. It then walks every object in the array and collects the union of keys - so if one object has email and another has phone, the header row contains both and objects missing a key produce empty cells for that column. Key order in the header follows first-appearance across the object sequence.
Value serialisation handles the RFC 4180 quoting rules: any cell containing the active delimiter, a double quote, a carriage return, or a newline is wrapped in double quotes, and embedded double quotes are doubled (so say "hi" becomes "say ""hi"""). Nested objects and arrays serialise to JSON strings inside the cell because CSV has no nested structure concept; a value like {"address":{"city":"NY"}} becomes the literal text {"city":"NY"} quoted as a string. Booleans render as true/false, numbers as their JSON literal form, and null as an empty cell.
Real-World Uses
- Exporting an API response to a
.csvthat you can open in Excel or Google Sheets for stakeholder review. - Dumping a list of users from a NoSQL database to CSV for import into a CRM or a data warehouse.
- Preparing data for bulk-upload into services that accept CSV but not JSON (Mailchimp imports, Salesforce Data Loader).
- Building a quick spreadsheet pivot over JSON log data without spinning up a full analytics pipeline.
- Generating a deterministic CSV test fixture from a JSON seed so both formats stay in sync.
- Converting a public JSON dataset into CSV for students or analysts who prefer spreadsheet tooling.
Gotchas to Watch For
- Heterogeneous objects. If your array mixes object shapes ("user" records and "event" records), the union-of-keys approach produces a sparse matrix with many empty cells. Consider filtering the array first so each conversion handles one shape.
- Deep nesting. Nested objects and arrays serialise as JSON strings. That means downstream readers (Excel, Sheets) see text like
{"city":"NY"}rather than separate columns. Flatten the data with a map step before converting if you need one column per leaf field. - Locale-specific delimiters. If your audience uses Excel in a locale where semicolon is the list separator, pick Semicolon. Otherwise the file opens with everything in column A. US/UK Excel uses comma by default.
- Line endings. The output uses
\\r\\nper RFC 4180, which Excel prefers. Unix tools tolerate CRLF but may show^Martefacts in old editors; convert withdos2unixif needed. - Booleans and null. JavaScript
nullbecomes empty; the string"null"becomes the literal text "null". Those are not the same thing downstream. Be explicit about which you want.
CSV Specification Background
RFC 4180 ("Common Format and MIME Type for CSV Files") is the closest thing to a canonical CSV spec. It requires CRLF line endings, double-quote escaping for special characters, and an optional header row. It also acknowledges that CSV in the wild varies widely. The RFC\'s quoting rules are the part worth memorising: wrap a field in double quotes if it contains a comma, a quote, or a line break; double any quotes inside the wrapped field. That algorithm - no more, no less - is what this converter implements. The MIME type is text/csv; for TSV the de facto type is text/tab-separated-values. Neither is used widely because browsers typically treat CSV/TSV as generic application/octet-stream downloads.
Compared to Other Converters
Command-line users reach for jq -r '.[] | [.a, .b, .c] | @csv' when they know the schema or csvkit\'s in2csv when they do not. Those tools scale to gigabytes and handle edge cases like reading from stdin with streaming. Spreadsheets have built-in CSV export but require loading the data first. Dedicated ETL frameworks like Airbyte or dbt handle JSON-to-CSV as one transformation among many. This in-browser tool wins on latency for ad hoc conversions of a few hundred to a few thousand rows; beyond that the memory pressure on a tab becomes noticeable and you should graduate to jq or a dedicated script.
Frequently Asked Questions
What JSON shape does the converter expect?
It requires a top-level array whose elements are objects, like <code>[{"a":1},{"a":2,"b":3}]</code>. An object at the top level fails because there is no obvious row definition. An array of primitives fails because there are no keys. If you have nested objects you want to flatten into row-like records, run a <code>.map</code> with your own flattening logic first, then paste the flat result in.
How does the tool pick the column order?
The column order follows first-appearance: if object #1 introduces <code>id</code> and <code>name</code> and object #3 adds <code>email</code>, the columns are <code>id,name,email</code> in that order. That keeps the header deterministic given the same input. If you want alphabetic or custom ordering, sort the keys yourself or specify them in code using <code>JSON.stringify</code> with a replacer.
What happens when an object is missing a key?
The cell is left empty. That is different from the cell containing the string "null" or the string "undefined" - the serialised row simply has a blank in that column. Empty cells are ambiguous in CSV (empty string vs null) and your downstream tool will need its own convention, which is one reason JSON is a better format when absence matters.
How are strings with commas or quotes inside escaped?
The RFC 4180 way. Any string containing the delimiter, a double quote, or a newline gets wrapped in double quotes, and internal double quotes are doubled (<code>"</code> becomes <code>""</code>). So <code>He said "hi", then left</code> becomes <code>"He said ""hi"", then left"</code>. That round-trips through Excel, Google Sheets, LibreOffice, and any RFC-compliant parser including the sibling CSV-to-JSON converter on this site.
Is my JSON uploaded to any server during conversion?
No. The logic runs inside your browser tab via a Preact component. Clicking Convert calls local JavaScript; there is no fetch request and no persistent storage. Because developers routinely paste API responses containing user emails, auth tokens, or internal IDs, the local-only guarantee is load-bearing. You can disconnect from the network after loading the page and the converter still works.
Can I download the result as an actual file?
Yes. Alongside the Copy button there is a Download button that uses a client-side <code>Blob</code> URL to save the output as <code>export.csv</code> (or <code>export.tsv</code> if you picked the tab delimiter). That also works offline once the page is cached. No upload happens when you download; the file is created in memory and saved directly to your filesystem.
Why did the output become one long line in Excel?
Excel respects the current Windows "list separator" setting, which is comma in US locales and semicolon in most of Europe. If the CSV uses a delimiter that Excel does not expect, every row gets dumped into column A. The fix is either to pick the delimiter Excel wants, or to import via <code>Data > Get Data > From Text</code> which lets you specify the delimiter explicitly.
How are numeric values formatted?
Numbers are serialised using JavaScript's default <code>toString()</code> for the number type. Integers that fit in 64-bit float safely (up to about 9 quadrillion) render exactly; very large integers lose precision because JSON and JavaScript share the same limitation. Scientific notation is used for extreme values. If your consumer needs specific decimal formatting, post-process or coerce to strings first.
What if my JSON contains nested arrays?
Nested arrays serialise as their JSON string representation and appear inside one cell. So <code>[1,2,3]</code> becomes the cell text <code>[1,2,3]</code> (quoted because of the commas). Downstream readers see that as a single string value, not multiple columns. If you need to explode an array into multiple columns or multiple rows, do that transformation before conversion.
Is the output deterministic across runs?
Yes for the same input. Given identical JSON bytes you get identical CSV bytes: the header order is fixed by first-appearance of keys, quoting rules are deterministic, and values serialise the same way every call. That makes the output suitable for test fixtures and for byte-for-byte diffing of data exports across runs.
More Developer Tools
Base64 Encoder & Decoder
Encode UTF-8 text to Base64 online or decode Base64 back to UTF-8 and plain text. Runs in your browser with no upload.
Open toolBulk URL Encode / Decode
Encode or decode many URLs at once. Paste a newline-separated list and the tool processes each line in parallel, preserving order and blank lines.
Open toolCode Screenshot
Create beautiful code snippet images with customizable themes.
Open toolColor Converter
Convert colors between HEX, RGB, HSL and CMYK formats.
Open toolCron Expression Parser
Parse cron expressions into human-readable schedules with next run times.
Open toolCSS Formatter / Minifier
Format, beautify and minify CSS code.
Open tool