SEOLyzerPro
Use 47 free online tools: meta tag and robots.txt generators, image and text tools, JSON converters, calculators and unit converters. No signup needed
CSV to JSON Converter
Turn spreadsheet data into JSON
CSV to JSON Converter
What this tool does
The CSV to JSON Converter turns a table in CSV format into JSON data. Paste the content of a CSV file, click Convert, and the tool produces a JSON list in which each row becomes an object, and the column headings become the keys. Developers use it to feed spreadsheet data into a web app, an API or a database import, and site owners use it to move data out of Excel or Google Sheets into a format that programs can read.
How to use it
- Paste the CSV text into the input box. The first line should contain the column names.
- Choose the delimiter if the tool asks, such as comma, semicolon or tab.
- Click Convert.
- Check the JSON, then copy it or download it. Use Reset to start again.
A worked example
CSV input:
name,age,city
Ali,30,Lahore
Sara,25,Karachi
JSON output:
[
{"name": "Ali", "age": "30", "city": "Lahore"},
{"name": "Sara", "age": "25", "city": "Karachi"}
]
The first row became the keys. Each following row became an object, and the output is a list of two objects. Notice that “30” and “25” appear in quotation marks in this output, which means they are stored as text. Some converters detect numbers and write 30 and 25 without quotes.
Text or numbers?
CSV has no data types, so a converter has to guess. Automatic conversion is convenient, but it can cause damage:
- A postal code such as 00123 would become the number 123, and the leading zeros would be lost.
- A phone number such as 03001234567 would lose its first zero.
- A very long ID, for example 12345678901234567890, is larger than the largest integer that JavaScript can store exactly, which is 9,007,199,254,740,991. The converted number would be rounded, and the last digits would change.
- Values such as 1E5 can be read as a number in scientific notation.
For this reason, many tools keep every value as text by default, or let you choose. If your IDs or codes matter, keep them as text.
How the conversion works
The converter reads the first line as the header row. Then it reads every other line, splits it into values at each delimiter, and pairs the values with the headers by position. The result is an array of objects. A second common output format is an array of arrays, where the header row is the first array and every row is a list of values without keys. The object format is easier to read and is what most APIs expect.
Quoted values and commas
When a value contains a comma, a double quote or a line break, CSV wraps it in double quotes, and a quote inside the value is doubled. For example:
name,note
"Smith, John","He said ""hello"""
becomes:
[{"name": "Smith, John", "note": "He said \"hello\""}]
The converter must handle these rules correctly. A simple tool that splits every line at each comma would wrongly cut “Smith, John” into two values. If your result has more values in some rows than the heading row, an unquoted comma in the data is a likely cause.
Delimiters and regional differences
The word “comma” is in the name, but files use other separators too. A semicolon is common in countries that write decimal numbers with a comma, such as 3,14. A tab separates values in TSV files, and the pipe character appears in some exports. If the converter finds only one column in the output, the delimiter is probably wrong. Choose the right one and convert again.
Common problems and fixes
| Problem | Likely cause | What to try |
|---|---|---|
| Everything is in one key | Wrong delimiter | Select semicolon or tab |
| Keys look odd or have strange characters at the start | A hidden byte order mark (BOM) at the start of the file | Remove it, or save the file again as UTF-8 |
| Fewer or more values than headings | An unquoted comma or a broken line | Check the row, and add quotes around values with commas |
| Empty objects at the end | Blank lines at the end of the file | Remove empty lines |
| Duplicate keys | Two columns have the same heading | Rename the columns before converting |
| Accented or Urdu characters look wrong | Wrong text encoding | Save the CSV as UTF-8 |
Empty cells
An empty cell can become an empty string “” or the value null. These are different in JSON, and some programs treat them differently. If you load the data into a database or an application, check which one it expects.
Using the result
The JSON can be used in a JavaScript program, saved as a .json file, sent to a web API, or used to fill a template. Before you rely on it, paste it into the JSON Formatter to check that it is valid and to read it more easily. If a spreadsheet had formulas, remember that the CSV holds only the calculated values.
Tips for good results
- Put a clear heading in the first row of the CSV, with simple names without spaces, such as first_name or firstName.
- Remove empty rows and notes above the table before you export.
- Export from your spreadsheet as CSV UTF-8, so that non-English text is kept.
- Keep codes and IDs as text.
- Check the first and last objects against your original data.
- For very large files, use a script or a command-line tool on your own computer.
Privacy
“The conversion happens in your browser and your data is not sent to our server.” CSV files often contain customer or business information. Remove private details before you paste data into any online tool.
Limits of this tool
The converter changes the format. It does not check whether the data is correct, remove duplicates or fix mistakes. It cannot rebuild nested structures that were flattened earlier, and the result depends on how clean the CSV is. Large inputs may be slow in older browsers.
Frequently asked questions
Does the first row have to be a header?
For the usual object output, yes. The first row provides the keys.
Why are my numbers in quotation marks?
The tool keeps values as text, which protects values such as zip codes and IDs.
What if my data has commas inside values?
They must be wrapped in double quotes in the CSV.
Can I use a semicolon-separated file?
Yes, if the tool supports that delimiter. Choose it before converting.
Can I convert JSON back to CSV?
Yes, with the JSON to CSV Converter.
Related tools
JSON to CSV Converter, JSON Formatter, Text Compare, Remove Line Breaks, Base64 Decode and URL Encode.