JSON ↔ CSV Converter
JSON ↔ CSV Converter
Convert between CSV/TSV and JSON with delimiter auto-detection, header row mapping, field trimming, and empty line skipping. Useful for data import/export, spreadsheet processing, and API payload preparation.
🚀 Quick Start
- Paste or type CSV/TSV in the right-side editor; the left JSON pane updates automatically.
- You can also edit JSON on the left, and the right CSV pane stays in sync.
- Delimiter is set to "Auto" by default. The tool inspects the first row and detects comma, tab, semicolon, or vertical bar (|).
- With "Use header row" enabled, the first CSV row becomes JSON object keys; when disabled, output is a 2D array.
- Use "Trim fields" and "Skip empty lines" to clean up messy CSV data.
- Download each side independently: download JSON as .json, and download CSV as .csv or .tsv based on the selected delimiter.
📌 Common Scenarios
- Excel to JSON: copy tab-separated cells from Excel into the CSV pane and convert to a JSON object array instantly.
- API response to spreadsheet: convert JSON responses to CSV for analysis in Excel or Google Sheets.
- Database import prep: convert CSV datasets to JSON for batch API imports.
- Log analysis: convert CSV logs to JSON for structured querying with tools like jq.
- Config migration: switch between CSV mapping tables and JSON config files.
- Data cleanup: quickly clean exported data with field trimming and empty-line skipping.
🧭 Usage Advice
- Data pasted from Excel is usually tab-delimited and is detected correctly. If detection is wrong, choose the delimiter manually.
- When "Use header row" is on, the first row is treated as column names. Turn it off if your CSV has no header.
- If duplicate header names exist, suffixes are added automatically (for example, name, name_2) to keep JSON keys unique.
- JSON → CSV works best with flat object arrays. Nested objects/arrays are serialized as JSON strings in cells.
- Fields containing delimiters, newlines, or double quotes are automatically quoted and escaped per CSV rules.
⚠️ Limitations & Compatibility
- CSV is a flat tabular format and cannot natively represent nested structures. Nested JSON objects/arrays are serialized as strings and cannot be fully restored on reverse conversion.
- CSV stores values as text. After a JSON → CSV → JSON round trip, numbers and booleans may come back as strings.
- UTF-8 BOM (\uFEFF) is removed automatically. Other encodings (for example, GBK or Shift-JIS) are not supported; convert to UTF-8 first.
- Like JSON in JavaScript, this tool follows IEEE 754 limits. Integers beyond 53-bit safe range may lose precision.
🔒 Privacy & Security
- All processing happens locally in your browser. Your data never leaves your device.
❓ FAQ
What is CSV, and how is it related to TSV and Excel?
CSV (Comma-Separated Values) is a plain-text table format where each line is a record and fields are separated by commas. TSV is the tab-delimited variant. Excel can open and export both formats, but .xlsx itself is a binary workbook format. This tool works with plain-text CSV/TSV, not .xlsx files. Historically, CSV had no single strict standard. In 2005, RFC 4180 defined common rules: fields are comma-separated, fields with special characters are wrapped in double quotes, and quotes inside quoted fields are escaped as two double quotes. Different apps still implement CSV with small differences, which is why import/export issues are common.
How does "Auto" delimiter detection work? Can it be wrong?
The tool scans the first row and counts commas, tabs, semicolons, and vertical bars (|) that appear outside quoted fields, then picks the most frequent one as delimiter. This is accurate for most well-formed CSV/TSV data. Mis-detection can happen when there is only one column (no delimiter appears), or when field content itself contains many delimiter characters. If that happens, choose the delimiter manually.
What changes when "Use header row" is on or off?
When enabled, the first CSV row is treated as column names, and each record becomes a JSON object keyed by those names (for example, {"name": "Alice", "age": "30"}). When disabled, all rows including the first are treated as data and converted to a 2D array (for example, [["name", "age"], ["Alice", "30"]]). In JSON → CSV direction, enabling header outputs object keys as the first CSV row.
My JSON contains nested objects. Can I convert back losslessly after CSV?
Not fully. During JSON → CSV, nested objects/arrays are serialized with JSON.stringify into cell text. During CSV → JSON, those values remain strings and are not auto-parsed back to objects. If you need structural fidelity, flatten JSON before conversion.
Can I convert data copied from Excel directly?
Yes. When you copy a cell range from Excel and paste it into the CSV editor, the data is usually tab-delimited. Auto detection identifies it as TSV and converts correctly. If you want a comma-delimited .csv download, switch delimiter to comma before downloading.
How are quotes and line breaks handled in CSV fields?
The tool follows RFC 4180: if a field contains a delimiter, newline, or double-quote character, the entire field is wrapped in double quotes; quotes inside the field are escaped as two consecutive double quotes (""). Parsing and output generation both follow this rule. If input contains an unclosed quote mark, you will see the "Unclosed quote in CSV input" error.