User Guide
Overview
This CSV to JSON converter transforms CSV (Comma-Separated Values) data into structured JSON (JavaScript Object Notation) arrays. It also works as a JSON to CSV converter for exporting JSON data back to spreadsheet format.
CSV is the universal format for spreadsheet data and data exports. JSON is the standard format for web APIs and applications. This tool bridges the gap when you need to import spreadsheet data into applications or export JSON for use in Excel or Google Sheets.
When to Use This Tool
Use this CSV JSON converter when working between spreadsheets and APIs. After conversion, use our JSON Formatter to beautify the output.
- Importing spreadsheet data into a web application or database
- Converting data exports for API consumption
- Preparing bulk data for database seeding or testing
- Transforming report data for visualization libraries
- Converting JSON API responses into spreadsheet format for analysis
- Migrating data between different systems and formats
How to Use
- Select the conversion direction - Choose "CSV to JSON" or "JSON to CSV" using the toggle buttons.
- Paste your input data - For CSV, paste your comma-separated data with headers in the first row. For JSON, paste an array of objects.
- Click Convert - Press the Convert button to transform your data.
- Copy the result - Use the Copy button to copy the converted output to your clipboard.
- Swap and convert back - Click "Swap & Convert Back" to reverse the conversion if needed.
How It Works
CSV to JSON Conversion
- Header row becomes JSON object property names
- Data rows become individual JSON objects in an array
- Quoted values handle commas within data correctly
- Type inference automatically converts numbers and booleans
- Empty cells become null values
JSON to CSV Conversion
- Object keys become CSV column headers
- Array elements become individual rows
- Nested objects are stringified or flattened
- Special characters are properly quoted and escaped
Limitations and Considerations
- Flat structure only - CSV cannot represent nested data structures. Nested JSON objects are stringified.
- Consistent keys - For JSON to CSV, all objects should have the same properties for best results.
- Array values - JSON arrays within objects are joined with commas in CSV output.
- Data types - CSV treats everything as text; type information is inferred but may not always be correct.
- Large files - Very large files may slow down your browser. Consider splitting large datasets.
Examples
CSV to JSON Example
Converting a user list from CSV to JSON:
name,email,age,active
John Doe,john@example.com,30,true
Jane Smith,jane@example.com,25,true
Bob Wilson,bob@example.com,35,false[
{
"name": "John Doe",
"email": "john@example.com",
"age": 30,
"active": true
},
{
"name": "Jane Smith",
"email": "jane@example.com",
"age": 25,
"active": true
},
{
"name": "Bob Wilson",
"email": "bob@example.com",
"age": 35,
"active": false
}
]JSON to CSV Example
Converting product data from JSON to CSV:
[
{
"id": 1,
"name": "Widget",
"price": 29.99,
"inStock": true
},
{
"id": 2,
"name": "Gadget",
"price": 49.99,
"inStock": false
},
{
"id": 3,
"name": "Gizmo",
"price": 19.99,
"inStock": true
}
]id,name,price,inStock
1,Widget,29.99,true
2,Gadget,49.99,false
3,Gizmo,19.99,true