Overview
The CSV to JSON converter parses CSV (Comma-Separated Values) data into JSON arrays of objects. Features automatic header detection, type inference, and robust parsing that handles quoted fields, escaped characters, and edge cases.Use Cases
- Data Import: Import CSV exports from Excel, Google Sheets, or databases
- API Preparation: Convert CSV datasets for JSON-based APIs
- Data Processing: Transform tabular data for JavaScript/Python processing
- Configuration: Convert CSV config files to JSON for applications
- Testing: Generate JSON test fixtures from CSV data
Input Format
Standard CSV with headers:With Quoted Fields
Tab-Delimited
Output Format
JSON array of objects with type conversion:Examples
Features
- Automatic Header Detection: First row treated as column names
- Type Inference: Automatically converts numbers, booleans, null
- Quoted Field Support: Handles fields with commas, quotes, newlines
- Tab Support: Detects and parses tab-delimited values
- Empty Line Handling: Skips empty rows automatically
- Error Reporting: Clear error messages for malformed CSV
Type Conversion Rules
Numbers
{"price": 99.99}
Booleans
{"active": true}, {"active": false}
Null
{"value": null}
Strings
All other values remain strings, including:- Numbers with leading zeros:
"001" - Dates:
"2024-01-15" - Mixed content:
"abc123"
Implementation Details
Fromlib/tools/engine.ts:606-617:
Uses
papaparse with dynamicTyping: true for intelligent type conversion. Numbers, booleans, and null values are automatically detected and converted.