How to convert CSV to JSON without uploading your file

Customer lists, exports and spreadsheets often should not be uploaded to a random website. You do not need to.

In your browser, nothing uploaded

Modern browsers can read a file you pick and process it locally. Tooltern's converter does exactly that: the file never leaves your computer, there is no account and no log. It detects the delimiter, keeps tricky values safe and shows a table preview before you download the JSON. You can check for yourself by turning off your Wi-Fi after the page has loaded: it still works.

On the command line

If Python is installed, this turns a CSV with a header row into a JSON array of objects:

python3 -c "import csv,json,sys; print(json.dumps(list(csv.DictReader(sys.stdin)), indent=2))" < people.csv > people.json

Every value stays a string, which is the safe default. If you have jq or Miller, mlr --icsv --ojson cat people.csv does the same with type guessing.

Traps to watch for

Questions

Is it safe to convert a CSV online?

It depends on whether the site uploads your file. A converter that works in your browser, like this one, never sends the data anywhere; one that processes it on a server can see and keep everything in it.

How do I keep leading zeros when converting CSV to JSON?

Do not convert those columns to numbers. Tooltern's type inference already keeps values like 007 or 01234 as text, and you can turn type guessing off entirely.

Why is my CSV all in one column?

It probably uses semicolons or tabs instead of commas. Pick the delimiter, or let the converter detect it.

Published .

Try it

Related guides

Newest guides