logo
GeekFormat

CSV to JSON

GeekFormat's online CSV to JSON converter quickly transforms Comma-Separated Values (CSV) tabular data into standard JSON arrays, ideal for API integration, data migration, and frontend test data preparation. Core features: ① Automatic delimiter detection: intelligently identifies comma, semicolon (common in Europe), and tab (TSV) delimiters and normalizes to comma; ② Header row detection: automatically uses the first row as JSON object keys, each subsequent row becomes a JSON object; ③ Smart repair: auto-fills empty columns or truncates extra columns for mismatched column counts, auto-closes unclosed quotes, one-click repair of formatting issues before conversion; ④ RFC 4180 standard parsing: correctly handles double-quoted fields, commas within quotes, double-quote escaping ("" → "); ⑤ Dual output modes: pretty-printed JSON with 2-space indentation (easy reading/debugging) and minified mode (smaller size for production); ⑥ 400ms debounce real-time conversion—get results as you type; ⑦ Supports .csv/.txt file upload, one-click download as converted.json, drag-resizable left/right panels, local history auto-save, mobile tab switching, direct jump to JSON Formatter tool after conversion for further processing. All parsing and conversion runs locally in browser—no data uploads.

Related

Use Cases

  • Frontend developers converting Excel-exported test data CSVs to JSON arrays as mock data during API integration
  • Backend developers converting CSV to JSON to verify field mapping correctness before data import
  • Data migration converting CSV format data to JSON for document databases like MongoDB
  • Batch generating test data: editing test cases in Excel, converting to JSON for direct import into test frameworks
  • SEO specialists converting keyword/URL list CSVs to JSON-LD structured data
  • Product/ops teams converting exported spreadsheet data to JSON for developer configuration files
  • Processing semicolon-separated CSVs from European clients/colleagues without manually replacing semicolons with commas
  • Quickly converting CSV-format data from web scraping to JSON for subsequent processing
  • Converting CSV to JSON for loading in JavaScript/Python before data analysis
  • Converting CSV example data in API docs to JSON examples for frontend-backend alignment
  • Visually observing correspondence between two data formats when learning CSV and JSON
  • Converting CSV to platform-required JSON format before low-code/no-code platform data import

Features

  • Smart delimiter detection: automatically identifies three common delimiters—comma (,), semicolon (;), tab (\t)—and normalizes to standard comma separation. Semicolon CSVs from European Excel and TSV files can be pasted directly and recognized
  • RFC 4180 standard parsing: correctly handles quoted fields (fields containing commas/newlines), double-quote escaping ("" within fields becomes "), conforms to official CSV specification without parsing errors
  • Automatic header detection: first row is automatically used as JSON object keys (Key), each data row converted to a JSON object, outputting standard JSON array format
  • Smart error repair: auto-fills empty columns or truncates extra columns for mismatched column counts, auto-closes unclosed quotes, one-click repair for common CSV format errors
  • Precise error location: parsing errors show line numbers and error details (column mismatch, quote issues) per row; yellow warning area lists all problematic rows for easy troubleshooting
  • Pretty/minified dual output: pretty output uses 2-space indentation with clear hierarchy for reading and debugging; minified output strips whitespace for smaller size suited for production
  • 400ms debounce real-time conversion: auto-converts after input without clicking buttons—fast pasting of large files won't cause lag
  • File upload and download: supports uploading .csv and .txt files to read content directly, one-click download of conversion results as converted.json file
  • Built-in sample data: click 'Sample' button to load preset CSV example to quickly try features or reference format
  • Local history auto-save: automatically saves recent input to localStorage, restoring last data on next open—no re-pasting needed
  • Resizable left/right panels: drag the middle divider on desktop to freely adjust width ratio of left/right panels—more comfortable for long content on large screens
  • One-click jump to JSON Formatter: after conversion click button to jump directly to JSON Formatter tool with results loaded for further processing—no manual copy-paste
  • Mobile adapted: input/output switched via tabs on phones, touch-friendly for on-the-go debugging conversions
  • Pure local browser processing: all CSV parsing and JSON conversion done in local JavaScript, data never uploaded to servers—safe for sensitive business data

How to Use

  1. Paste CSV data into left editor, or click 'Import' to upload .csv/.txt file, or click 'Sample' to load example data
  2. Tool auto-detects delimiter and converts with 400ms debounce, showing JSON results on right in real time
  3. If column mismatches or quote errors exist, yellow warning area appears; click 'Fix Structure' for one-click auto-repair
  4. Toggle 'Pretty Output' switch as needed (indent/minify); when satisfied with results click 'Copy' or 'Export' to download JSON file, or click button to jump to JSON Formatter for further processing

FAQ

Which CSV delimiters are supported?

Three most common delimiters are automatically recognized: comma (,)—standard CSV default; semicolon (;)—commonly used in European Excel (because Europe uses comma as decimal separator); tab (\t)—TSV file format. After pasting, the tool auto-detects which delimiter to use and normalizes to standard comma-separated before parsing.

What if fields contain commas or newlines?

The tool follows RFC 4180 CSV standard: if field content contains commas, newlines, or quotes, wrap the field in double quotes (e.g., "Smith, John"); double quotes within fields need to be escaped with two double quotes (e.g., "He said ""Hello"""). The parser correctly handles these cases and won't mistake commas within fields for delimiters.

Must the first row be headers?

Yes, the tool defaults to first row as headers (column names), automatically used as JSON object keys. If your CSV has no headers, manually add column names in the first row (e.g., col1,col2,col3) and adjust after conversion.

What does 'column count mismatch' error mean?

CSV requires each row to have the same number of columns as the header row. If a comma-separated row has more or fewer fields than the header column count, this error appears. The tool handles it automatically: fills missing columns with empty strings, truncates extra columns, and lists all problematic line numbers in the yellow warning area. You can also click the 'Fix Structure' button for one-click auto-repair.

What does 'unclosed quote' mean?

Per RFC standard, double-quoted fields must have opening and closing quotes. If a row has an odd number of quotes, it means a quote wasn't closed (possibly truncated during copy). The tool detects this and attempts to auto-add a closing quote at the end, listing the problematic line number.

Can it convert Excel-exported CSVs?

Yes. CSVs exported from Excel (both Windows and Mac versions) as well as semicolon-separated CSVs exported from European Excel can be correctly identified and parsed. Note: choose 'CSV UTF-8' format when exporting from Excel to avoid Chinese character garbling; the tool fully supports UTF-8 encoding.

Are TSV (tab-separated) files supported?

Yes. Directly paste tab-separated content or upload .tsv/.txt files—the tool auto-detects tab separation and converts to standard comma-separated before parsing, no manual replacement needed.

What does the converted JSON look like?

Outputs standard JSON array format where each array element is a JSON object with keys from CSV header row and values from corresponding column string values. For example, name,age\nJohn,25 converts to [{"name":"John","age":"25"}]. Note: all values are string type—if you need numeric types, convert in your code.

Why are all values strings? Can it output number/boolean types?

CSV format itself carries no type information—all fields are text. The tool defaults to converting everything to strings for safety to avoid type misjudgment (e.g., ID 00123 converted to number becomes 123 losing leading zeros). If you need type conversion, process in code after getting JSON, or use JSON Formatter tool for further processing.

Can I upload files? What formats are supported?

Supports uploading .csv and .txt format files. Click upload button to select a file or drag into input area—file content is read into the input box and auto-converted. Files are read locally in browser, never uploaded to servers.

How do I quickly verify JSON is correct after conversion?

After successful conversion, the status bar shows number of successfully converted rows; additionally a one-click 'JSON Formatter' jump button opens JSON Formatter tool in new tab with conversion results pre-loaded for further verification and formatting.

How large a CSV file can it handle?

Pure frontend processing is perfectly adequate for daily development scenarios up to tens of thousands of lines (hundreds of KB to several MB). For extremely large files (tens of MB+, millions of lines), professional data processing tools are recommended—but API debugging, data preparation, batch conversion and other dev scenarios work flawlessly.

Will Chinese or special characters get garbled?

No. The tool processes text in UTF-8 encoding, fully supporting Chinese, Japanese, Emoji and other Unicode characters. If you see garbled text when reading from file, confirm the file is saved as UTF-8 (choose 'CSV UTF-8' when exporting from Excel).

Why is content I pasted before still there next time?

The tool automatically saves your input CSV content to browser localStorage, restoring last input on page open so you don't need to re-paste every time. This is pure local storage—data never uploaded, completely safe. Click Clear button to remove current content.

Will data be uploaded to servers?

No. All CSV parsing, error repair, and JSON conversion happen entirely in your browser's local JavaScript. Input CSV data and conversion results are never sent over the network to any server. CSV files containing sensitive business data or internal information can be converted safely.

About CSV Format and JSON Conversion

CSV (Comma-Separated Values) is the most universal tabular data text format, supported for import/export by nearly all spreadsheet software (Excel, Google Sheets, Numbers, WPS), and is one of the most commonly used formats for data exchange and batch import/export. JSON (JavaScript Object Notation) is the most widely used data interchange format in Web APIs and modern programming. CSV to JSON is an extremely frequent need in development: CSVs exported from Excel by product/ops need conversion to JSON for APIs, CSVs exported from databases need conversion to JSON for mock data, CSV needs importing into document databases like MongoDB during data migration... A good conversion tool saves enormous time manually constructing JSON.

CSV looks simple—commas separate fields, newlines separate rows—but there are many pitfalls: what if a field contains a comma? What about newlines within fields? How to escape quotes? CSVs exported from different countries may also use semicolons as delimiters (Europe because comma is decimal separator) or tab separation (TSV format). Failing to handle these issues leads to incorrect parsed data. This tool implements a parser following RFC 4180 CSV standard, correctly handling edge cases like quoted fields, double-quote escaping, and commas/newlines within fields—not simply string.split(','), producing accurate and reliable results.

Automatic delimiter detection is a very practical feature. Many developers' first instinct when getting a CSV file is to use split(','), but European Excel defaults to semicolon (;) separation—splitting on comma treats the entire row as one field; TSV files use tabs, making comma split completely wrong. The tool counts occurrences of commas, semicolons, and tabs per row, automatically determines the most likely delimiter and normalizes it—just paste regardless of file source.

Smart error repair is the core feature that differentiates this from simple online tools. Real-world CSVs are often malformed: some rows have wrong column counts (copy-paste truncation, extra commas in middle), some have unclosed quotes (export issues), some mix delimiters—direct parsing fails or produces wrong results. The tool doesn't simply refuse conversion when encountering these problems: instead it ① lists all problematic line numbers and error reasons; ② provides one-click repair button to auto-fill empty columns/truncate/add quotes; ③ outputs usable JSON results even with warnings, avoiding whole-file conversion failure from one bad row.

Pretty/minified dual output modes correspond to different use cases: pretty mode for development/debugging/reading—2-space indentation, clear hierarchy, object structure visible at a glance; minified mode for production/API responses/config files—strips all whitespace/newlines for smaller size and faster transmission. Toggle switch re-renders instantly without re-conversion.

Why is pure local processing important? CSV files often contain real business data, customer information, unreleased product data and other sensitive content—uploading to third-party conversion servers carries data leakage risk. All parsing and conversion logic in this tool executes in browser-local JavaScript; files are only processed in your computer's memory with zero network requests, works offline, fundamentally solving data security issues. Local processing also has speed advantages—multi-MB files convert instantly without upload/download waits.

Draggable divider panel and local history are details optimized for high-frequency use: widen input area when processing wide tables, widen output area when focusing on results; unfinished CSVs from last session auto-restore on next open—no need to dig through email/chat history to find files and re-paste. One-click jump to JSON Formatter considers real workflow—after converting JSON you typically need formatting, validation, minification—direct jump without re-copy-paste to open new page.

Notes: ① All CSV values are uniformly converted to string type by design—CSV has no type information, auto-converting numbers/booleans can cause errors (e.g., zip code 00123, ID numbers lose leading zeros); handle type conversion in code if needed; ② Currently only supports unidirectional CSV→JSON conversion; use corresponding tool on this site for JSON→CSV; ③ Extremely large files (>10MB, millions of lines) recommend command-line tools (e.g., csvtojson, jq)—this tool targets development/debugging scenarios, smooth up to tens of thousands of lines in daily use.

术语表

CSV
Comma-Separated Values, a format storing tabular data in plain text with one record per row and fields separated by commas—the most universal import/export format for spreadsheets and databases.
RFC 4180
Formal standard document for CSV format defining rules for field quoting, double-quote escaping, newline handling, etc.—this tool follows this standard for parsing.
TSV
Tab-Separated Values, a format using Tab (\t) instead of commas to separate fields—automatically recognized and supported by this tool.
Automatic Delimiter Detection
Tool automatically detects whether file uses comma, semicolon, or tab as delimiter—no manual selection needed, making CSVs from different sources more convenient to process.
Header
First row of CSV containing column names for each column, converted to JSON object keys (Key) after conversion.
JSON Array
This tool's output format—a comma-separated list of JSON objects wrapped in square brackets, each object corresponding to one CSV data row.
Double-Quote Escaping
Per RFC standard, double quotes within fields are represented by two consecutive double quotes (""), restored to single double quote during parsing.
Column Count Mismatch
Error where a row's field count doesn't match header field count; tool auto-fills empty values or truncates and marks warning.
Debounce
Wait 400ms of no new input after typing before executing conversion, avoiding re-parsing large files on every keystroke which causes lag.
Pretty Print
JSON format with indentation and newlines, clear hierarchy for human reading and debugging.
Minify
JSON format with all whitespace and newlines stripped, minimal size suitable for transmission and production.
localStorage
Browser local storage used by tool to auto-save last input content; data exists only on user's local machine, never uploaded to servers.

CSV Delimiter Reference by Region

Default CSV delimiter differences in Excel exports by country/region:

Region/LanguageDefault DelimiterDecimal SeparatorTool Support
US/UK/China/JapanComma ,Period .
Germany/France/Italy/SpainSemicolon ;Comma ,✅ Auto-detected
Generic TSV FormatTab \t-✅ Auto-detected

CSV to JSON Example

Input/output format comparison:

Content
CSV Inputname,age,city\nJohn,25,New York\nJane,30,London
JSON Output[{"name":"John","age":"25","city":"New York"},{"name":"Jane","age":"30","city":"London"}]

Common Errors and Fixes

Common CSV parsing issues and handling:

Error TypeCauseAuto-Repair Handling
Column mismatch (fewer columns)Row has insufficient delimiters, fewer fields than headerAuto-fills end with empty strings
Column mismatch (extra columns)Row has extra commas or improperly quoted fieldsAuto-truncates extra fields
Unclosed quoteOdd number of quotes, field not properly terminatedAuto-appends double quote at end of line
Wrong delimiterFile uses semicolon or tab instead of commaAuto-detects and uniformly replaces with comma

Privacy & Security

All CSV parsing, delimiter detection, error repair, JSON conversion, and file reading in this CSV to JSON tool happen entirely in your browser locally via JavaScript. Your pasted CSV content and uploaded file data are never uploaded to any server, nor recorded, stored, or analyzed. Local history is saved only in your own browser's localStorage and can be deleted by closing or clearing browser data. CSV files containing sensitive business data, customer information, or internal data can be used safely with zero data leakage risk.

Authoritative References

Troubleshooting

What to do about Chinese character garbling?

Garbling is typically a file encoding issue. Ensure CSV file is saved as UTF-8 encoding: when exporting from Excel choose 'CSV UTF-8 (Comma delimited)' format rather than plain 'CSV (Comma delimited)' (which is GBK encoding on Chinese Windows). If file is GBK encoded, open in Notepad and save-as UTF-8 before uploading.

All content becomes one column after conversion?

Indicates delimiter wasn't correctly recognized. Check what delimiter your CSV uses to separate fields—European Excel defaults to semicolon (;), supported by auto-detection in this tool; if other special delimiters (like pipe |), replace with comma in editor before converting.

Why did numbers become strings?

This is expected behavior. CSV format itself carries no type information—all fields are text. Automatically converting fields that look like numbers to Number type causes leading zero loss (e.g., 00123 becomes 123) and precision loss for long numbers (e.g., order numbers exceeding 15 digits). If you need numeric types, convert them in your code.

Browser lags after pasting large files?

Tool includes 400ms debounce optimization, but for extremely large CSVs (10MB+) with hundreds of thousands of lines, browser processing still strains. Recommendations: ① First extract needed portions in Excel/VS Code before converting; ② Command-line tools like csvtojson, jq, Python pandas are more appropriate for very large files. Daily dev scenarios (thousands to tens of thousands of lines) run perfectly smoothly.