What does this tool do?
This free CSV to JSON converter turns a CSV table into a JSON array of objects as you type, and converts JSON back to CSV with the reverse toggle. It runs entirely in your browser — nothing you paste is uploaded — so it is safe for any data. If you mainly need the other direction — a JSON array flattened into a spreadsheet — the dedicated JSON to CSV page opens ready for that.
How the conversion works
- The first row is the header. Each header cell becomes a key.
- Every following row becomes one JSON object:
{ "header1": value1, "header2": value2, ... }. - Types are detected: values that look like numbers,
true,false, ornullare converted to the matching JSON type. Everything else stays a string, and values with leading zeros (like007) are kept as strings so they are not mangled. - Quoted fields may contain commas, newlines, and escaped double quotes (
""), following the standard CSV format.
For example this CSV:
name,age,city Ann,30,Paris Cy,41,"Oslo, NO"
becomes:
[
{ "name": "Ann", "age": 30, "city": "Paris" },
{ "name": "Cy", "age": 41, "city": "Oslo, NO" }
]
Real-world examples
The most common reason to convert CSV to JSON is to take a spreadsheet or a CRM/analytics export and feed it to an API or a script that expects JSON. Type detection makes the output ready to use rather than all-strings — for example:
name,active,score,zip Ann,true,9.5,007 Bob,false,,90210
becomes:
[
{ "name": "Ann", "active": true, "score": 9.5, "zip": "007" },
{ "name": "Bob", "active": false, "score": "", "zip": "90210" }
]
Note the details: true/false became booleans, 9.5 a number, the empty cell an empty string, and 007 stayed a string so the leading zero survives.
Convert CSV to JSON in code (Python, CLI)
This page is the zero-install option; inside a script:
- Python (csv):
import csv, json; print(json.dumps(list(csv.DictReader(open("in.csv")))))— noteDictReaderkeeps every value a string, so you cast types yourself. - Python (pandas):
import pandas as pd; pd.read_csv("in.csv").to_json("out.json", orient="records")— pandas infers numeric types for you. - Command line:
csvjson in.csv(from csvkit), ormlr --icsv --ojson cat in.csvwith Miller.
How to use it
- Paste CSV on the left; the JSON appears live on the right.
- Choose 2 spaces, 4 spaces, or tabs with the JSON indent control.
- Copy the JSON or Download a
.jsonfile. - Switch the toggle to JSON → CSV to go back the other way.
Type detection rules
The converter infers a JSON type for each cell so the output is ready to use rather than all-strings. The rules are deliberately conservative:
42and-3.14become numbers;007,+1-555and anything with a leading zero or a non-numeric character stay strings.trueandfalsebecome booleans, andnullbecomes null.- An empty cell becomes an empty string
""; everything else is left as a string.
So an ID, a ZIP code, or a version like 1.0 is usually kept as text automatically — the leading-zero and non-numeric rules protect them — but you can always quote and clean up afterwards if needed.
Common uses
- Import a spreadsheet export into code that expects JSON.
- Turn analytics or CRM CSV exports into JSON for an API or script.
- Quickly reshape tabular data without writing a parser.
FAQ
Does it use the first row as keys?
Yes. The first CSV row is the header; each following row becomes a JSON object keyed by those headers.
Are numbers and booleans detected?
Yes. Values that look like numbers, true, false, or null become the matching JSON type; everything else stays a string. Leading-zero values stay strings.
Does it handle commas inside quoted fields?
Yes. Quoted fields may contain commas, newlines, and escaped double quotes, following the standard CSV (RFC 4180) format.
Can I convert JSON back to CSV?
Yes. Switch the toggle to JSON → CSV and paste a JSON array of objects to get a CSV table back.
Does it support tab- or semicolon-separated files?
This converter expects comma-separated values. For a TSV or semicolon-separated file, replace the delimiter with commas first, then paste it in.
Does it work offline?
Yes. Once the page has loaded the conversion runs entirely on your device, with no network connection.
Is my data uploaded?
No. Everything runs in your browser; nothing you paste leaves your device.