My Tool Studio
Developer

CSV to JSON

You've got a spreadsheet of test users, product rows, or survey results, and your code wants objects. Paste the table into this csv to json tool: the header row becomes your keys, every following line becomes an object, and numbers and booleans come back typed instead of quoted. That makes it a fast way to seed fixtures, mock an API, or load reference data into a script without writing a throwaway parser. TSV usually parses as well, since the delimiter is detected. Everything runs on your device, so an export full of customer records never leaves your machine.

Always freeNo sign upRuns in your browser
Output appears here...

How to use

01

Paste the table

CSV from Excel, Google Sheets, or a database export goes straight into the input pane. Try sample loads a three-line table with a header row.

02

Hit Convert to JSON

The header line supplies the keys and each row becomes one object. Values are typed as they're read, so 30 stays a number and true becomes a boolean.

03

Drop the JSON into your code

Copy the two-space indented output into a fixture file, an API request, or a seed script. Adjust the CSV and rerun the conversion whenever it changes.

Why CSV to JSON

Common questions

How does the converter decide what the keys are?
The first line of your input is treated as the header, and each header cell becomes a key on every object. That's also how you convert csv file to json file contents: paste the whole file including its header line, and the structure falls out automatically. No header row means your first data row gets misused as keys, so add one if it's missing.
Are the values typed, or does everything become a string?
Typed. Numeric cells become numbers, true and false become booleans, and empty lines are skipped entirely. That saves the usual cleanup pass where every field arrives as text. If you need a numeric-looking value kept as a string, like a zip code with a leading zero, quote it in the CSV.
What if I need the reverse, JSON back into a table?
That's the JSON to CSV page, which will convert json to csv with keys as headers. It also answers the json to csv online searches, and if your end goal is to convert to csv file output for a spreadsheet user, that's the direction you want. The two pages are designed as a pair.
Can it produce SQL, XLS, or TXT instead of JSON?
No, output here is JSON only. To convert csv to sql, generate insert statements from the JSON in a small script, and to convert csv to xls or convert csv to txt, open the CSV in a spreadsheet and export the target format from there. Those detours are quick because the hard part, parsing the CSV correctly, is already done.
Does plain text or TSV work as input?
TSV generally works as pasted, because the parser detects the delimiter. Free-form text does not; to convert text to csv you need to shape it into delimited lines with a consistent number of fields first. Once it looks like a table, this page will happily turn it into objects.
Is comparing two CSV exports something this page does?
No, it converts rather than compares. To compare csv files online, paste each export into a text diff tool and read the line-level changes, or convert both files here and diff the JSON if you care about typed values. People wanting to compare 2 csv files online usually find the diff route quicker.
Why choose this csv to json converter online over writing a script?
For one-off jobs, the browser wins: no environment, no dependency install, correct handling of quoted fields and CRLF line endings out of the box. Scripts earn their keep when the conversion runs on a schedule. For seeding a fixture before lunch, paste and convert.
Is it safe to convert csv to json online with sensitive data?
Here, yes, because nothing is transmitted; parsing happens in your browser's memory and the data disappears when you close the tab. That's the deciding factor when the CSV holds emails or order histories. With any converter that uploads to a server, the honest answer would be no.

More Developer tools

View all