toolqik

109 · Encode & Convert

CSV to JSON

Turn CSV or Excel exports into a JSON array, with types.

Runs in your browser
Output
Indent
Options
JSON

  

About this tool

Spreadsheets, database exports and reporting tools all speak CSV, while APIs, JavaScript and NoSQL databases want JSON. This CSV to JSON converter turns rows into a JSON array in one step: each row becomes an object whose keys come from the header. It detects the delimiter, handles quoted fields with commas and line breaks, and can turn numbers and true/false into real JSON types. Conversion runs in your browser, so customer lists and exports never leave your machine.

How to use it

  1. Paste CSV, drop a .csv or .tsv file onto the box, or click Open file. Excel and Google Sheets exports work directly.
  2. The delimiter is detected automatically. Choose it yourself if the result looks wrong.
  3. Pick the output shape, then copy the JSON or download it as data.json. Open Table preview to check that columns lined up.

Output formats

For this input:

id,name,active
1,Ada,true
2,Grace,false
OutputResultUse it for
Objects[{"id": 1, "name": "Ada", "active": true}, …]APIs, JavaScript, MongoDB imports. The most common choice.
Arrays[[1, "Ada", true], [2, "Grace", false]]Charts and tables, or when column names repeat or are missing.
JSON LinesOne object per line, no surrounding arrayLog pipelines, BigQuery and Elasticsearch bulk loads, and streaming huge files.

How values are converted

With Numbers & booleans on:

  • 42, -3.5 and 1e6 become numbers; true and false become booleans; empty cells and null become null.
  • Values that would change if converted stay strings: leading zeros such as ZIP codes and phone numbers (02134), and integers too large for JavaScript to store exactly, such as 19-digit IDs.
  • Turn the option off to keep every value as a string, exactly as written in the file.

Duplicate header names get a suffix (name, name_2) so no column is lost, and blank headers become column_3 and so on. If a row has more or fewer cells than the header, the converter fills the gap with null and tells you how many rows were affected.

CSV rules this converter follows

CSV has a standard, RFC 4180, which most tools follow:

  • Fields containing the delimiter, a double quote or a line break are wrapped in double quotes: "Smith, Jr.".
  • A double quote inside a quoted field is written twice: "She said ""hi""".
  • Line endings can be Windows (CRLF) or Unix (LF). Blank lines are skipped, and the byte-order mark Excel adds is removed.

Excel in many European locales saves CSV with semicolons, because the comma is the decimal separator there. Automatic detection handles that, as well as tab-separated (TSV) and pipe-separated files.

Convert CSV to JSON in code

import csv, json

# utf-8-sig drops the BOM that Excel adds to UTF-8 CSV files
with open("data.csv", newline="", encoding="utf-8-sig") as f:
    rows = list(csv.DictReader(f))          # every value is a string

print(json.dumps(rows, indent=2, ensure_ascii=False))

FAQ

How do I convert CSV to JSON?

Paste the CSV or drop the file into the box above. Each row becomes a JSON object with the header row as keys. Copy the result or download it as data.json.

Can I convert an Excel file to JSON?

Save or export the sheet as CSV first (File → Save As → CSV UTF-8 in Excel, or File → Download → CSV in Google Sheets), then convert it here.

Why are my numbers strings?

CSV has no types, so every value is text. Turn on "Numbers & booleans" to convert them. Values with leading zeros or very large integers stay strings on purpose, so no data changes.

My CSV uses semicolons. Will it work?

Yes. The delimiter is detected automatically from the first lines. You can also choose comma, semicolon, tab or pipe yourself.

How large a file can I convert?

Tens of megabytes. Conversion runs in a background worker so the page stays responsive, and the on-page preview is limited to keep it fast, while Copy and Download include everything.

Is my data uploaded?

No. The conversion runs entirely in your browser; the file never leaves your device.

esc
↑↓ navigate↵ open