Free JSON to CSV Converter
Convert JSON arrays to CSV and CSV back to JSON. Handles nested values, quoted fields, and commas in values automatically.
Common uses
- Export JSON API Data to CSVConvert JSON API responses and data exports into CSV format for Excel, Google Sheets, and databases.
- Convert JSON to Excel-ready CSVTurn any JSON data file or API response into a flat CSV that Excel and Google Sheets can open directly.
- Prepare JSON Data for Database ImportConvert JSON exports to CSV for bulk import into MySQL, PostgreSQL, SQLite, and other databases.
- Convert JSON Reports to CSV for AnalysisTransform JSON analytics data, reports, and logs into CSV for business intelligence and data analysis.
- JSON to CSV for Developer WorkflowsQuickly convert test fixtures, mock data, and config JSON to CSV or back β part of your data pipeline.
How It Works
This tool converts between JSON and CSV entirely in your browser using zero external libraries β the conversion logic is hand-written TypeScript that runs locally. JSON parsing uses the browser's native JSON.parse, while CSV parsing uses a custom RFC 4180 state-machine that handles the edge cases most naive converters get wrong.
- 1JSON parsed and headers collectedJSON.parse() reads the input and validates it as an array. The converter then walks every object in the array to build a union of all keys β so sparse arrays where different rows have different fields still produce a complete header row.
- 2Optional nested-object flatteningIf the flatten option is on, nested objects like {"address":{"city":"Oslo"}} are recursively collapsed into dot-notation columns (address.city) before headers are built. Arrays and empty objects are left as JSON-stringified cell values.
- 3RFC 4180-compliant cell encoding with formula neutralizationEach cell value is escaped per RFC 4180: fields containing commas, double-quotes, or newlines are wrapped in double-quotes, and internal quotes are doubled. Safe Export mode (on by default) also prefixes any cell starting with =, +, -, or @ with a single quote, preventing spreadsheet apps like Excel or Google Sheets from treating injected values as executable formulas.
- 4CSV-to-JSON uses a character-level state machineReversing direction, the shared parseCsv function walks the input character-by-character, tracking whether it is inside a quoted field to correctly handle embedded commas, escaped double-quotes (""), and newlines inside cells β cases that a simple line-split approach mishandles. detectDelimiter sniffs the first row for comma, semicolon, tab, or pipe to support non-standard exports automatically.
Related Tools
Excel / XLSX Viewer
Open and view .xlsx, .xls, .csv, and .ods spreadsheets without Excel or Google Sheets. Switch sheets and export to CSV or JSON. Runs entirely in your browser.
JSON to Excel
Convert a JSON array of objects into an Excel (XLSX) or CSV spreadsheet. Nested objects become dotted columns. Runs entirely in your browser β no upload.
PDF to Excel
Extract tables from PDF bank statements, invoices and reports into Excel (.xlsx) or CSV. Preview the rows first; amounts stay real numbers. Runs in your browser β nothing is uploaded.