use case
How to convert a CSV file to JSON
Parse a CSV export from a database or spreadsheet into a JSON array for use in code.
Database exports, CRM data dumps, and spreadsheet reports arrive as CSV files. Modern applications expect JSON. Converting CSV to JSON lets you feed that data into a REST API, import it into MongoDB, or process it with JavaScript without a heavyweight ETL tool. This guide shows how to parse any CSV to a clean JSON array in seconds.
Step-by-step guide
- Open the CSV and copy its contents: Open the .csv file in a text editor (not Excel — Excel may reformat values). Copy all content including the header row.
- Select csv-to-json mode: Paste into the converter and set mode to 'csv-to-json'. If the CSV uses semicolons or tabs, set the matching delimiter.
- Use the JSON array in your code: The output is a JSON array of objects where each key is a column header and each value is a string. Use JSON.parse() in JavaScript or json.loads() in Python to work with the result programmatically.
Frequently asked questions
- Why are all values strings in the JSON output?
- CSV has no type information — every cell is plain text. The converter preserves this by outputting all values as strings. To type your data, post-process the JSON: parseInt(row.age), parseFloat(row.price), new Date(row.created_at).
- What if my CSV has no header row?
- The converter treats the first row as headers. If your CSV has no header row, add one manually before pasting. For example, prepend 'id,name,email\n' to a headerless CSV.
Try it now
Use the JSON to CSV Converter to complete this task — free, no sign-up, runs in your browser.
Open JSON to CSV Converter →