JSON to CSV Converter
Flatten nested JSON files, auto-repair coding syntax errors, and edit spreadsheet grids.
Source JSON Data
Paste JSON array or upload file.
Ready to Convert
Paste raw arrays on the left panel, and click Execute to see clean tabular data configurations.
Related Tools
Explore more free tools that pair well with this one.
JSON Formatter
Format, minify, auto-repair broken JSON, inspect interactive tree view, and convert JSON into TypeScript interfaces, Go structs, Python Pydantic, Rust serde, YAML, XML, and CSV.
Code to Image
Turn your source code into beautiful, high-resolution code snippet images for Twitter, LinkedIn, tech blogs, and documentation. Custom syntax themes, gradient backgrounds, macOS window frames, and 4K PNG exports.
Regex Tester
Test regular expressions in real-time with visual match highlighting, capture groups breakdown, flag toggles (g, i, m, s, u), preset regex templates, and an interactive cheat sheet.
Binary & Base64
Convert text to base64, base64 to text, text to binary, and binary to text. Free online client-side encoder tool with real-time translation and file download.
JWT Debugger
Decode, verify, and generate JWT (JSON Web Tokens) online. Inspect Header, Claims Payload, Signature verification, and exp/iat timestamps in real-time. 100% private client-side parsing.
Color Matrix Game
Test your memory with Color Matrix game online for free! Remember and repeat flashing color sequences.
Understanding JSON Arrays vs. CSV Formats
JSON (JavaScript Object Notation) is the industry standard format for API data transmissions due to its support for nested objects and array loops. However, business analytics, databases, and editors like Excel require tabular flat file boundaries represented by Comma Separated Values (CSV). Converting nested JSON layers to plain CSV requires flattening the tree nodes.
Our JSON to CSV converter reads tree arrays recursively. When it hits nested configurations, it maps the hierarchies using dot notation identifiers (e.g. `billing.address.zip`) to form clean spreadsheet header titles. If the pasted input contains minor syntax mistakes (such as single quotes or missing double-quotes on parameters), our local **Syntax Repair engine** matches and cleans them automatically.
JSON Auto-Repair: What It Actually Fixes (and What It Doesn't)
The "Auto-Repair invalid syntax templates" checkbox runs your pasted text through a small, focused set of regular expressions before the browser's native JSON.parse() ever sees it. Specifically, it rewrites unquoted or single-quoted object keys into standard double-quoted keys, converts single-quoted string values to double-quoted values, and strips trailing commas that appear right before a closing } or ]. These three fixes cover the overwhelming majority of "almost-JSON" you'll encounter when copying data out of Python dictionaries, JavaScript console logs, or hand-edited config files.
It is important to be honest about the limits of this feature: it is a pattern-matching cleanup pass, not a full permissive JSON5 or JSONC parser. Missing colons, unbalanced brackets, comments inside the JSON, or deeply malformed nesting will still cause the conversion to fail with an error message rather than being silently guessed at. If auto-repair cannot produce syntactically valid JSON, you will see a "Conversion Failed" alert naming the underlying parse error so you can fix the source text manually.
How Nested Object Flattening Works (Dot Notation Explained)
When the "Flatten nested keys" checkbox is enabled, the converter recursively walks every plain object it finds inside each array item. A nested structure such as {"user": {"profile": {"age": 30}}} becomes a single flat column named user.profile.age holding the value 30 — no separate columns, no lost data, just a predictable, spreadsheet-friendly naming scheme. This is genuinely recursive: objects nested three, four, or more levels deep are all merged down into one flat row using the same dot-joined naming convention, and the tool automatically collects the full, deduplicated set of column headers across every item in your array before building the CSV, so items with slightly different shapes (some records missing an optional field, for example) still line up correctly with blank cells where data is absent.
If you uncheck "Flatten nested keys," nested objects are not expanded into dot-notation columns at all — they are instead converted to their raw JavaScript string representation and dropped into a single cell as-is, which is rarely what you want for a genuinely nested dataset but can be useful if you only care about the top-level fields and want to keep the rest as a reference blob.
The Array Flattening Limitation You Should Know About
This is worth calling out plainly rather than leaving you to discover it by trial and error: flattening applies only to nested plain objects, not to arrays. If a field's value is itself an array — for example "tags": ["urgent", "billing", "vip"] — that array is not split into tags.0, tags.1, tags.2 columns. Instead, it is converted using JavaScript's default array-to-string behavior, which joins simple values with commas into a single cell, so you would see a cell containing urgent,billing,vip. Because CSV also uses commas as its field separator, our export logic detects this and automatically wraps that cell in quotes so it survives as one column rather than being misread as three.
Arrays that contain objects rather than simple values — a common shape for line items, order history, or address lists — are handled a bit differently: each object in the array is serialized to a compact JSON string, so a value like "items": [{"sku":"A1","qty":2},{"sku":"B2","qty":1}] becomes a single cell containing {"sku":"A1","qty":2},{"sku":"B2","qty":1} rather than the unhelpful [object Object] placeholder. That keeps every field's actual data visible and copy-pasteable, even though it isn't split into per-item columns. If your source JSON contains arrays of objects that you need represented as real columns or additional rows, the practical workaround is still to pre-process that data (for example, exporting one row per array item instead of nesting it) before pasting it into this converter — the tool intentionally keeps its flattening logic simple and predictable rather than guessing how you'd like deeply nested arrays restructured.
CSV to JSON: How the Reverse Conversion Works
Switching to the "CSV to JSON Converter" tab flips the workflow: paste or upload a CSV file, and the first line is always treated as your column headers. Every subsequent line is parsed into a JSON object whose keys come from those headers, and the full result is returned as a JSON array — one object per data row — formatted with two-space indentation for readability. The parser uses a pattern that specifically looks for either a quoted block ("...") or a run of non-comma characters for each field, which lets it correctly handle a comma that appears inside a quoted value (such as an address like "123 Main St, Suite 4") without incorrectly splitting that value into two columns.
This reverse parser also correctly handles quoted values that span multiple physical lines. Rather than splitting the input into lines up front, it scans the text character by character and tracks whether it is currently inside an open double-quote, only treating a line break as the end of a row when it is outside quotes — so a CSV cell containing an embedded line break (a multi-paragraph note field, for instance) is reassembled into a single field instead of being misread as the start of a new row. Doubled double-quotes ("") inside a quoted field are also unescaped back into a single literal quote character.
What This Tool Does Not (Yet) Support
In the interest of setting accurate expectations, here is a short, honest list of features this converter does not currently include: there is no selector for alternate delimiters such as semicolons or tabs — every CSV produced or consumed uses a standard comma; on the CSV-to-JSON side there is still no toggle to treat headerless CSV as data-only on import — the first line is always assumed to be column names (though on the JSON-to-CSV side, the "Include header row in CSV output" checkbox does let you skip writing the header row on export); and there is no in-grid cell editing — the search and sort controls let you inspect and filter converted data, but changing an actual value requires editing your source text and re-running the conversion. None of these are permanent design limits, but as of today they are not implemented, and we would rather tell you that directly than let marketing copy imply otherwise.
Quote Escaping and Why It Matters
Proper CSV escaping is what separates a spreadsheet import that "just works" from one that silently corrupts your data. On the JSON-to-CSV path, every field value is checked for a comma, a double-quote character, or a line break; if any of those are present, the entire value is wrapped in double quotes and any internal double quotes are doubled (so a value like She said "hello" is written out as "She said ""hello"""), which matches the widely used RFC 4180 convention that Excel, Google Sheets, and most database import tools expect. This means product descriptions, addresses, and free-text comments containing commas or quotation marks will still open correctly as single cells rather than being split apart or breaking your spreadsheet's column alignment.
Step-by-Step: Converting JSON to CSV
- Make sure the "JSON to CSV Converter" tab is selected (it is the default view).
- Paste a JSON array of objects into the source panel, or click "Load File" to import a
.jsonfile from disk. - Leave "Auto-Repair invalid syntax templates" checked if your JSON might contain minor formatting mistakes, and leave "Flatten nested keys" checked if your objects contain nested sub-objects you want expanded into dot-notation columns.
- Click "Execute Formatting & Convert." The tool parses your data, builds column headers from every unique key found across all items, and renders the result in the interactive data grid.
- Use "Copy Raw" to copy the generated CSV text to your clipboard, or "Download File" to save it as a
.csvfile you can open directly in Excel, Google Sheets, or Numbers.
Step-by-Step: Converting CSV to JSON
- Click the "CSV to JSON Converter" tab to switch modes; the source panel placeholder and labels update automatically.
- Paste your CSV data (with a header row as the first line) or upload a
.csvfile. - Click "Execute Formatting & Convert." Each subsequent line becomes one JSON object, keyed by the header row.
- Review the parsed rows in the data grid, using the search box to spot-check specific values.
- Copy or download the resulting pretty-printed JSON array for use in your application, database seed script, or API testing tool.
Using the Interactive Data Grid: Search, Sort, Copy, Download
Every successful conversion populates a live, scrollable data grid so you can sanity-check the result before trusting it. Clicking any column header toggles ascending or descending sort on that column using a simple locale-aware string comparison — handy for spotting outliers or confirming that a numeric-looking field sorted the way you expected. The search box above the grid filters rows in real time by checking whether any value in the row (across all columns) contains your search text, which is a fast way to confirm a specific record made it through the conversion intact. Both "Copy Raw" and "Download File" always operate on the full converted dataset, not just the currently filtered or sorted view, so a search term you typed to spot-check a record won't accidentally trim your exported file.
Privacy & Data Handling: Why Nothing Leaves Your Browser
Both conversion directions run entirely as local JavaScript string and array operations inside the page you're currently viewing. There is no server-side upload endpoint involved in the conversion logic itself — no fetch, no XMLHttpRequest, and no form submission carries your pasted or uploaded data anywhere. Whether you're converting an internal HR export, customer records, or a confidential API response, the content only ever exists in your browser tab's memory for the duration of your session and is discarded the moment you navigate away, close the tab, or refresh the page. This also means there is no auto-save: if you want to keep a conversion, download or copy it before leaving the page.
Common Mistakes to Avoid
- Forgetting the header row on CSV input: the first line of any CSV you paste is always treated as column names, never as data — if your export tool omitted headers, add a header line manually before converting.
- Expecting arrays of objects to flatten into columns: as covered above, only nested objects flatten; nested arrays of objects are serialized to a compact JSON string per cell rather than expanding into per-item columns.
- Assuming a custom delimiter is supported: despite what some documentation elsewhere may suggest, only comma-separated values are currently supported for both import and export.
- Assuming quoted multi-line cells will break the parser: they won't — the CSV-to-JSON parser tracks open quotes character by character, so a cell's text can safely wrap across multiple physical lines in the source file without misaligning rows.
- Not reviewing the grid before downloading: always scroll through the interactive preview first — it takes a few seconds and catches most structural surprises before they end up in a file you share with someone else.
This Tool vs. Excel Power Query, jq, and Pandas
For quick, one-off conversions of moderately sized JSON or CSV data, this browser tool is faster to reach for than opening a Python environment to run pandas.json_normalize() or writing a jq filter expression from scratch — there's nothing to install, and results are visible in a live preview grid within seconds. For genuinely complex transformations, however — deeply nested arrays of objects that need to become multiple related tables, custom column renaming rules, or processing files in the hundreds of megabytes — a proper scripting tool or Excel's Power Query editor remains the better choice, since those tools are purpose-built for arbitrary reshaping logic that a lightweight in-browser flattener intentionally doesn't attempt to replicate.
Practical Tips for Clean Conversions
Before converting a large JSON export, skim a couple of sample records for inconsistent field shapes — for instance, one record storing a phone number as a string and another as a number — since the flattener will preserve whatever type each value already has rather than normalizing it. When converting CSV to JSON, open your source file in a plain text editor first if you suspect it may contain multi-line cells or unusual quoting, since fixing those issues before pasting is far faster than debugging a misaligned JSON array afterward. And whenever you're working with sensitive data, remember that closing the tab clears everything from memory — so download or copy your result as the very last step of your workflow, not as an afterthought.
Frequently Asked Questions
Our validation algorithm scans for common faults like trailing commas, single quotes on keys/values, and unquoted object keys. It replaces them dynamically using regular expressions prior to parsing.
Not currently. The converter always outputs and expects standard comma-separated values — there is no delimiter selector in the interface. If you need semicolon- or tab-separated output, you'll need to find-and-replace commas in the downloaded file yourself.
There's no hard-coded limit in the script, but since everything runs in your browser's memory rather than on a server, we recommend keeping input under roughly 5MB (about 50,000 spreadsheet rows) for a smooth, responsive experience.
Nested objects flatten into dot-notation columns, but arrays do not split into separate columns. A simple array like ["a","b"] becomes the text "a,b" in one cell, while an array of objects is serialized to compact JSON text in that cell (e.g. {"sku":"A1"},{"sku":"B2"}) instead of the unhelpful "[object Object]" placeholder — restructure that data before converting if you need each item broken out into its own column.
You can skip the header row on export — uncheck "Include header row in CSV output" and the generated CSV starts straight from the data. There's still no way to rename columns inline, and the first line of any CSV you paste for CSV-to-JSON conversion is always treated as headers.
On JSON-to-CSV, yes: values with commas, quotes, or line breaks are automatically wrapped in double quotes with internal quotes doubled (RFC 4180 style). On CSV-to-JSON, the parser reads character by character while tracking open quotes, so quoted fields with embedded commas and quoted cells that span multiple physical lines both parse correctly into a single field.
The converter automatically wraps a single top-level object in a one-item array before processing, producing a valid one-row CSV rather than an error. It's safe to paste either a full array of records or a single object.
Yes. Click any column header to sort rows ascending or descending, and use the search box to filter rows by matching text across all columns. These are preview tools only — Copy Raw and Download always export the full dataset, and editing a value requires changing your source text and re-converting.
No account is needed, and nothing is saved between visits — there's no server-side history and no local auto-save. Closing the tab or refreshing the page clears your input and results, so download or copy your converted data before navigating away.
Yes. Click "Load File" to select a .json, .csv, or .txt file from your device — its contents are read locally with the browser's FileReader API and dropped straight into the source textarea for you to review before converting.