JSON to CSV Converter
Convert JSON arrays to downloadable CSV format.
About the JSON to CSV Converter
The JSON to CSV Converter takes a JSON array of flat (or shallowly-nested) objects and emits RFC 4180-compliant CSV. Paste a GitHub repos API payload, a Firestore export, or a SQL query result that arrived as JSON, and you get a spreadsheet-ready file you can drop into Excel, Google Sheets, pandas, or a LOAD DATA INFILE statement.
JSON and CSV model data differently. JSON is hierarchical — each object can hold nested objects and arrays, and every row of an array can carry a different set of keys. CSV is rectangular: every row has exactly the same columns, every cell is a string. The bridge is to collect the union of all keys across every object, treat that union as the column header, and emit an empty cell wherever an object lacks a key.
This tool also implements the quoting rules from RFC 4180 §2.7: any value containing the delimiter, a double quote, or a line break is wrapped in double quotes, and embedded double quotes are doubled (so He said "hi" becomes "He said ""hi"""). Without that escaping, Excel happily splits Springfield, IL across two columns.
The tool is timezone- and locale-aware in the sense that it preserves whatever strings you give it. Timestamps that arrive as ISO 8601 strings stay as strings; numbers stay as numbers; booleans become the literal strings true and false; null becomes an empty cell. None of these conversions are lossy for the common case where the consumer is a spreadsheet.
How It Works
Step one is JSON.parse and a guard that the top-level value is an array. Step two iterates the array to collect every unique key into a JavaScript Set; the set's iteration order becomes the column order. If an object is missing a key that appears elsewhere, the cell for that key is left empty.
Step three formats each cell. Numbers, booleans, and strings are stringified directly; null becomes an empty string; arrays are emitted as their JSON-encoded form (CSV has no native array type). When the Flatten option is on, nested objects are walked recursively and produce dotted column names such as owner.login instead of a single owner column whose cell is a JSON blob.
Step four applies RFC 4180 quoting. The rule is simple: if the value contains the chosen delimiter, a double quote, a CR, or an LF, wrap the whole value in double quotes and double every embedded double quote. Lines are joined with \n; some Windows consumers expect \r\n, which most editors (VS Code, Notepad++) will transparently handle when you save.
Worked Examples
The default input is a three-element array of GitHub repositories with the keys repo, stars, language, and last_push. With the header row enabled and a comma delimiter, the output is:
repo,stars,language,last_push ht99-tools,142,PHP,2025-09-14 stripe-php,4120,PHP,2025-10-02 react,232000,JavaScript,2025-10-12
Paste that into Excel and you immediately get a four-column table you can sort by star count.
Change the delimiter to Semicolon if your locale uses a comma as the decimal separator (much of the EU); Excel will then parse numbers like 4120 correctly rather than treating the comma as a column break.
If one repo object gained a nested owner: {"login":"facebook"} field, the default behaviour emits owner as a single column containing {"login":"facebook"}. Turn on Flatten and you get a clean owner.login column with the value facebook — ready to pivot on.
When to Use This Tool
- Converting a paginated REST API response to a CSV for ad-hoc analysis in Excel.
- Exporting a MongoDB or Firestore collection to CSV for a one-off report.
- Preparing a JSON dataset for a Python
pandas.read_csvcall without writing a custom script. - Generating a CSV template from a JSON Schema so non-developers can fill in rows.
- Importing JSON event logs into a spreadsheet for quick pivot tables.
- Feeding a CSV into a CRM or marketing tool that only accepts flat-file imports.
- Producing a TSV for paste-into-Sheets workflows (TSV avoids Excel's text-import wizard entirely).
Limitations & Disclaimer
The tool processes flat or shallowly-nested arrays. Deeply nested structures (objects inside arrays inside objects) are emitted as JSON strings rather than flattened — pre-extract the fields you need first. JSON Lines (NDJSON) input is not accepted; wrap the objects in an array. RFC 4180 quoting is implemented strictly, but a handful of legacy CSV consumers (older Microsoft Access drivers, some SAS configurations) interpret quoting differently and may mangle values containing embedded quotes. See our disclaimer for full terms.
Frequently Asked Questions
What happens if different objects have different keys?
The tool collects the union of every key across every object and uses that as the column set. Objects missing a key leave that cell empty. The result is a sparse CSV when schemas vary row-to-row; consider pre-filtering the array to a uniform shape if sparseness matters.
How are arrays inside objects handled?
Arrays are stringified as JSON and placed in a single cell. For example, <code>"labels":["bug","urgent"]</code> produces a cell containing <code>["bug","urgent"]</code>. CSV has no native array type, so this is the most faithful textual representation. To split array elements into one row each, pre-process the JSON with a <code>flatMap</code> step before pasting.
Can I export Unicode and emoji safely?
Yes. The output is UTF-8 and the quoting rule preserves any character. When opening in Excel on Windows, use the Data → From Text/CSV wizard and explicitly select UTF-8 to avoid the ‘mojibake’ effect on accented characters.
What is the difference between comma and semicolon delimiters?
Functionally none — both are valid RFC 4180 delimiters. The choice is regional: locales that use a comma as the decimal separator (most of continental Europe) default to semicolon-delimited CSV so that numbers like <code>3,14</code> are not split. Tab-delimited files (TSV) sidestep the issue entirely.
Does the tool handle JSON Lines (JSONL / NDJSON) input?
Not directly. JSONL is one JSON object per line, with no enclosing array. Wrap your objects in square brackets and separate them with commas before pasting. Some tools expose a JSONL mode natively; for now, a quick <code>[ ]</code> wrapper is the simplest fix.
Is my data uploaded anywhere?
No. Conversion runs in your browser. Customer records, financial rows, and PII never leave the device.
Last updated: September 9, 2026 · Author: HT99 Tools Editorial Team