Json To Csv LogoJson To Csv

How to Convert CSV to JSON: 3 Reliable Methods (2026 Guide)

Three reliable ways to turn CSV rows into clean JSON: a free online converter, a short Python script, and the Excel route — with headers, data types, and common fixes covered.

Updated: 2026-10-027 min read

What converting CSV to JSON actually does

CSV is flat: rows of values separated by a delimiter, with the first row usually holding the column headers. JSON is structured: objects with named keys, grouped in an array. Converting maps each data row to one object, and each header to a key.

The subtle part is data types. Every CSV cell is technically text, but JSON has real numbers, booleans, and nulls. A good converter infers types: 30 becomes a number, true becomes a boolean, empty cells become null. Keeping IDs and zip codes as text is deliberate — nobody wants 01310 to become 1310.

Method 1: Free online converter (fastest)

For a one-off conversion, an online tool is the fastest route — no installs, no code. Pick one that runs in your browser so your data never leaves your device.

  • Paste your CSV (or drop a .csv file) into the converter.
  • Confirm the delimiter: comma for most files, semicolon if your spreadsheet uses it.
  • Check the JSON preview — headers became keys, each row one object — then download the .json file.

Method 2: Python script (repeatable)

For developers and recurring jobs, a short Python script using pandas is the most repeatable option. It reads the header row automatically and writes a neatly indented JSON array.

Python
import pandas as pd

# The header row becomes the keys automatically
df = pd.read_csv("data.csv")

# orient="records" -> one JSON object per row
# force_ascii=False keeps accents readable (no \uXXXX escapes)
df.to_json("data.json", orient="records", indent=2, force_ascii=False)

Run it with python convert.py. If a column must stay text (IDs, zip codes with leading zeros), read it explicitly: pd.read_csv("data.csv", dtype={"zip": str}).

Method 3: Excel or Google Sheets

Here is the honest version: neither Excel nor Google Sheets can save a file as JSON natively. The practical path has two steps.

  • Clean the data in your spreadsheet, then save or download as CSV (UTF-8).
  • Convert that CSV to JSON with an online converter or the Python script above.
  • Tip: use Power Query (Data → From Table) to fix headers and remove blank rows before exporting the CSV.

Headers, delimiters, and data types

Three things decide whether the output is clean or garbage. First, the header row: it must exist and be unique — duplicate or missing headers produce broken keys. Second, the delimiter: European spreadsheets often export semicolons because the comma is the decimal separator there; if rows look shifted, the delimiter is wrong. Third, quoting: commas or quotes inside a field must be wrapped in double quotes (RFC 4180) — any real CSV does this, and converters expect it.

Dates are the classic trap: 03/04/2026 means March 4th in the US and April 3rd in most of Europe. When dates matter, normalize them to ISO format (2026-04-03) before converting.

Common problems and quick fixes

Most conversion headaches come down to four issues:

  • Garbled accents (mojibake): the file is not UTF-8. Re-save it with UTF-8 encoding (with BOM) before converting.
  • Everything came out as strings: type inference is off or the values were quoted. Enable the "infer types" option, or accept strings — APIs usually cope.
  • Rows look shifted: wrong delimiter, or line breaks inside unquoted fields. Re-export the CSV properly and try again.
  • Huge files freezing the browser: split the CSV into smaller chunks, or use the Python method above.

Going the other way: JSON to CSV

APIs hand you JSON and spreadsheets want CSV — the reverse trip is just as common. Our companion guide walks through the same three methods in reverse.

Read: How to Convert JSON to CSV

Related guides

Frequently asked questions

Is it safe to convert CSV to JSON online?

Yes, if the converter runs entirely in your browser. Your file is processed locally on your device and never uploaded to a server. Avoid tools that require uploading sensitive data to an unknown server.

Can Excel convert CSV to JSON directly?

No — Excel has no built-in JSON export. Save or download the sheet as CSV (UTF-8), then convert that CSV with an online tool or a short Python script. The same applies to Google Sheets.

Why did my numbers become strings in the JSON?

Because every CSV cell is text until something decides otherwise. Converters with type inference turn 30 into a number and true into a boolean; quoted values and ID-like columns stay strings on purpose, so zip codes keep their leading zeros.

Can I convert JSON back to CSV?

Yes. See our step-by-step guide "How to Convert JSON to CSV" — the same three methods (online converter, Excel, Python) work in the reverse direction.

Is there a free way to convert CSV to JSON without signing up?

Yes — browser-based converters are free with no account. Paste your CSV and download the JSON array. For jobs you run repeatedly, the short Python script in this guide runs offline with no limits at all.

How do I stop Excel from dropping leading zeros when converting to JSON?

Mark ID and zip-code columns as Text before saving the CSV: in Excel use Data → From Text/CSV and set the column type to Text, or read the file with dtype={"zip": str} in Python. Once the zeros are gone from the CSV, no converter can bring them back.

Can I convert a CSV file that uses semicolons to JSON?

Yes — just tell the converter the delimiter is a semicolon instead of a comma; European spreadsheets export this way by default. The Python method handles it with pd.read_csv("data.csv", sep=";").

Need the reverse trip?

Our free converter turns JSON into spreadsheet-ready CSV in seconds — the opposite direction, same privacy: no sign-up, no uploads.

Open the JSON to CSV converter
All guides