CSV to JSON converter
Turn a CSV file into JSON. Each row becomes an object, numbers stay numbers, and your file never leaves your browser.
Drop a CSV or Excel file here
CSV, TSV or .xlsx, up to 100 MB. It stays on your computer.
- No sign-up
- Nothing uploaded
- JSON or JSON Lines
JSON your code can use as it is.
Your file stays on your computer
The JSON is written in your browser. Nothing is sent to Mammoth or anyone else.
The right types, column by column
129.50 becomes the number 129.5 and true becomes a boolean. A ZIP code column keeps 02134 as text in every row.
Dotted columns become objects
customer.name and customer.country turn into one customer object, the reverse of flattening JSON to CSV.
How to convert CSV to JSON
The header row gives the keys, each row below it becomes one object, and each column gets one type.
- 1
Add your CSV
Drop a .csv file on the box, choose one, or paste the CSV in.
- 2
Pick the shape
An array of objects, or JSON Lines with one object per line.
- 3
Download or copy
Save the .json file, or copy it straight into your code.
Other ways to do it
If you write code, a few lines will do it too.
Python with pandas
A job you script once
- Keeps numbers as numbersYes
- Keeps leading zerosNo
- No code or installNo
- Runs on a scheduleYes
Python's csv module
No libraries allowed
- Keeps numbers as numbersNo
- Keeps leading zerosYes
- No code or installNo
- Runs on a scheduleYes
- This page
This converter
One-off files, no setup
- Keeps numbers as numbersYes
- Keeps leading zerosYes
- No code or installYes
- Runs on a scheduleNo
How to convert CSV to JSON in Python
pandas does it in one line. Without pandas, Python's own csv and json modules take five.
Going the other way? The JSON to CSV converter flattens nested JSON into columns.
import pandas as pd
pd.read_csv("orders.csv").to_json("orders.json", orient="records", indent=2)orient="records" gives one object per row. pandas reads 02134 as the number 2134, so pass dtype={"zip": str} for code columns.
import csv, json
with open("orders.csv", newline="") as f:
rows = list(csv.DictReader(f))
with open("orders.json", "w") as f:
json.dump(rows, f, indent=2)The csv module reads every value as text, so 129.50 becomes "129.50" in quotes.
Your file stays private
The converter runs inside this page. Your CSV is read and written out as JSON on your computer, and nothing is sent to Mammoth. That makes it safe for exports with customer data in them.
Once the page has loaded, it works with your internet switched off.
Turning the same CSV into JSON every week?
Mammoth can do it for you. Put the CSV files in a folder and their rows are added to one table, ready to download as JSON or JSON Lines.
Weekly exports
| Shop | Nov 02 | Order 1041 | 129.50 | |
| Wholesale | Nov 02 | Order 7710 | 1,200.00 | |
| Marketplace | Nov 03 | Order 3305 | 48.00 | |
| Shop | Nov 09 | Order 1077 | 310.25 | |
| Wholesale | Nov 09 | Order 7744 | 875.90 |
Illustration. Every new file in the folder is added to the same table.