Ad Space
CSV to JSON Converter Online Free
Convert CSV files or pasted CSV data to JSON format. Supports comma, semicolon, and tab delimiters. First row can be treated as headers for key names. Output is downloadable as a .json file.
Frequently Asked Questions
Does it support different delimiters?
Yes. Choose comma (,), semicolon (;), or tab as the delimiter. Tab-separated files (TSV) are also supported.
What happens to numeric values?
Numbers are automatically converted from strings to numbers in the JSON output. Strings remain as strings.
Can I convert without a header row?
Yes. Uncheck 'First row is header' and columns will be named field1, field2, field3, etc.
Is my CSV data sent to a server?
No. Parsing happens locally in your browser with JavaScript.
Related Tools
Ad Space
How to convert CSV to JSON online
A CSV file stores rows of data as plain text. JSON stores the same data as objects with named keys. Developers often need this change when they send data to an API, load a file into a script, or feed a web app. The steps below take about a minute.
Step by step
- Upload your .csv file, or paste the CSV text into the box.
- Check the delimiter. Look at your raw text: if values are split by commas, keep comma. If they are split by semicolons, pick semicolon. Files exported from spreadsheets in some regions use semicolons.
- Decide about the first row. Keep "First row is header" checked if the first line holds column names. Uncheck it if the first line is already data.
- Click Convert to JSON.
- Read the result. Then use Copy JSON or Download .json.
A worked example
Say you paste these three lines with a header row:
name,age,city
Lea,31,Lyon
Omar,28,Lille
The output is a list of two objects, one per data row:
[{"name":"Lea","age":31,"city":"Lyon"},{"name":"Omar","age":28,"city":"Lille"}]
The input has 3 lines. One is the header, so the JSON holds 3 − 1 = 2 objects. Each object has 3 keys, taken from the header. That makes 2 × 3 = 6 values in total.
Practical tips
- Count your columns first. Every row should have the same number of values. A missing comma shifts the data into the wrong key.
- Quote values that contain the delimiter. An address like "12 Rue Neuve, Lyon" should be wrapped in double quotes so the comma stays inside one value.
- Keep header names simple. Names without spaces, such as first_name, are easier to use in code than First Name.
- Watch out for leading zeros. A value like 00742 may be read as the number 742. If you need the zeros (postal codes, product codes), check the output and fix those fields in your code afterwards.
- Test with a few rows. With a large file, convert the first 5 or 10 lines and check the structure before you run the whole thing.
- Validate the result. Paste the JSON into a formatter to read it more easily or to spot an error.
Common uses
- Preparing test data for an API request.
- Turning a spreadsheet export into a file a web page can load.
- Creating a small data set for a JavaScript or Python project.
- Moving a product or contact list into a tool that only accepts JSON.
More questions about CSV and JSON
Why is my JSON output all in one key or one column?
The delimiter probably does not match your file. If your data uses semicolons but comma is selected, each line is read as a single value. Switch the delimiter and convert again.
Why do I see strange characters like é instead of é?
The file was probably saved in a different text encoding than the one being read. Re-export the CSV from your spreadsheet as UTF-8, then upload it again.
Can I turn the JSON back into CSV later?
Yes, if the JSON is a flat list of objects with the same keys, as in the example above. Nested objects or lists inside a value do not fit well in a table, so they need to be flattened first.