CSV to JSON Converter

Paste a CSV or open a file and get JSON right away. The header row becomes the keys, numbers and true/false values are detected, and zip codes keep their leading zeros. Everything runs in your browser, so your file is never uploaded.

0records0columns
JSON

What the CSV to JSON converter does

A CSV stores a table as plain text, one row per line. JSON stores the same data as named values that apps and APIs can read directly. This tool reads each row of your CSV and turns it into a JSON object, using the header row for the key names. It parses quoted values properly, detects the delimiter, and turns numbers and true/false into real JSON types. You can also get an array of arrays, an object keyed by an id column, or nested objects from dotted headers likeaddress.city.

Why use our CSV to JSON converter

  • ·No upload. Files are read on your device, so private data stays private.
  • ·Values stay correct. Leading zeros and long ids stay as text instead of being changed.
  • ·Works with Excel files. Semicolon files, UTF-8 with a byte order mark, and Windows-1252 files all read correctly.
  • ·Three output formats. Array of objects, array of arrays, or keyed by the first column.
  • ·Free. No signup and no limit on how often you use it.

How to convert CSV to JSON

  1. 1

    Paste or open your CSV

    Paste CSV text into the top box, or click the folder button to open a .csv, .tsv, or .txt file. You can also drag a file onto the box. The file is read on your device and never uploaded.

  2. 2

    Choose the JSON format

    Pick the output: an array of objects (the usual choice), an array of arrays, or an object keyed by the first column. Leave the delimiter on auto detect unless your file uses something unusual.

  3. 3

    Copy or download the JSON

    The JSON updates as you change the input or options. Copy it to your clipboard or download it as a .json file. An opened file keeps its name, so data.csv becomes data.json.

CSV to JSON output formats compared

Here is the same small CSV in each of the three output formats:

id,name,zip
1,Ada,01234
2,Grace,10001

Array of objects

The most common format. Each row is an object, and the header names are the keys. Most APIs, databases, and JavaScript code expect this.

[
  { "id": 1, "name": "Ada", "zip": "01234" },
  { "id": 2, "name": "Grace", "zip": 10001 }
]

Array of arrays

The table as rows of values, with the header first. It is smaller than an array of objects and is what many chart and table libraries take.

[
  ["id", "name", "zip"],
  [1, "Ada", "01234"],
  [2, "Grace", 10001]
]

Keyed by first column

One object where each value in the first column points to the rest of its row. It works well as a lookup table. JSON keys are always strings, and if two rows share the same first value, only the last one is kept (the tool tells you when this happens).

{
  "1": { "name": "Ada", "zip": "01234" },
  "2": { "name": "Grace", "zip": 10001 }
}

Notice that the zip 01234 stays a string while10001 becomes a number. If you need every zip code to be a string, turn off "Detect numbers and true/false".

CSV to JSON converter options

Delimiter
Auto detect looks at the first row and picks comma, tab, semicolon, or pipe, whichever splits it into the most fields. The detected delimiter is shown under the input. Set it by hand if a file is detected wrong.
Output
Array of objects uses the header row as keys for every record. Array of arrays keeps the table as rows of values, with the header as the first row. Keyed by first column makes one object where each first-column value (such as an id) points to the rest of that row.
Indent
2 spaces, 4 spaces, or tabs for JSON that is easy to read. Minified puts everything on one line for the smallest file.
First row is a header
On by default. Turn it off when your CSV has no header row, and the keys become column1, column2, and so on.
Detect numbers and true/false
Turns 42 and 3.5 into JSON numbers, true and false (in any case) into booleans, and the word null into null. Values with a leading zero, like 01234, and numbers with more than 15 significant digits stay as text so they are not changed. Turn it off to keep every value as a string.
Empty cells as null
Writes empty cells as null instead of an empty string (""). Many databases and APIs treat null as "no value", which is often what a blank cell means.
Trim spaces
Removes spaces at the start and end of every value and header. Spaces inside a value are kept.
Nest dotted headers
Turns headers like address.city and address.zip into a nested address object. It works with the object outputs, not with array of arrays.

Common problems converting an Excel CSV to JSON

Most broken conversions come from how the CSV was saved, not from the data itself. These are the issues people run into most:

  • ·The first key has a strange character in front of it. Excel's "CSV UTF-8" format adds an invisible byte order mark at the start of the file, which some converters glue onto the first header. This tool removes it, so the first key comes out clean.
  • ·Accented letters turn into question marks. On Windows, Excel's plain "CSV (Comma delimited)" format saves text in Windows-1252, not UTF-8. When an opened file is not valid UTF-8, this tool reads it as Windows-1252 instead and shows a note so you can check the result. When saving from Excel, choose "CSV UTF-8" to avoid the problem.
  • ·Everything ends up in one key. In many European countries, Excel saves CSV files with semicolons because the comma is used as the decimal point. Auto detect handles this. If you set the delimiter by hand, make sure it matches the file.
  • ·Zip codes and ids lose their leading zeros. Many converters turn 01234 into the number 1234. Here, any value with a leading zero stays a string. If the zeros are already missing in your CSV, Excel removed them when the file was saved. Set that column to Text in Excel before saving.
  • ·Long numbers end in zeros. Excel only keeps 15 significant digits, so a 16 digit card or order number saved from Excel can end in zeros. That happens before the CSV reaches this tool. In the JSON, numbers with more than 15 significant digits are kept as strings so they do not change.
  • ·Prices with commas stay as text. Values like "1,234" or a decimal comma like "1,5" are not plain numbers, so they stay as strings. Remove the thousands separators in your spreadsheet first if you need them as numbers.

Other ways to convert CSV to JSON

WhereHow
Python (standard library)json.dump(list(csv.DictReader(f)), out, indent=2). Every value stays a string
Python (pandas)pd.read_csv("data.csv").to_json("data.json", orient="records"). Leading zeros are dropped unless you pass dtype=str
Command line (Miller)mlr --icsv --ojson cat data.csv

Use this tool when you want the result without writing code or installing anything, or when you need to check how a file converts before you script it.

Who converts CSV to JSON

Spreadsheets export CSV, but most apps and APIs read JSON. These are the people who most often need to move data from one to the other:

  • ·Developers. Turn a spreadsheet export into seed data, a test fixture, or a config file. Numbers and booleans are typed for you, and the keyed output gives a quick lookup table by id.
  • ·Data and analytics teams. Send CSV exports to an API or a NoSQL database that expects JSON, with blank cells written as null if you need them.
  • ·No-code and website builders. Many site builders, chart libraries, and automation tools take JSON. Convert a sheet of products, locations, or FAQs without writing a script.
  • ·Anyone with a large export. Files up to 25 MB convert in the browser, which helps when a file is too big for an online converter's upload limit or too private to upload at all.

Frequently asked questions

How do I convert a CSV file to JSON?
Paste your CSV into the input box or open the file with the folder button. The tool converts it to a JSON array of objects right away, using the header row as keys. Copy the result or download it as a .json file. Nothing is uploaded.
How do I convert a CSV from Excel to JSON?
In Excel, choose File, Save As, and pick "CSV UTF-8 (Comma delimited)". Then open that file here. If your file was saved as plain "CSV (Comma delimited)", the tool reads it as Windows-1252 and shows a note so you can check accented letters.
Why are my numbers in quotes in the JSON?
Either "Detect numbers and true/false" is turned off, or the value is not a plain number. Values with a leading zero (01234), thousands separators (1,234), currency signs, or more than 15 significant digits stay as strings on purpose, so the value is never changed.
Why did my zip codes keep their leading zero?
A number cannot start with zero in JSON, so 01234 would have to become 1234 and lose a digit. Keeping it as a string means the value stays exactly as written in your CSV.
Does it handle commas and line breaks inside a field?
Yes. A value wrapped in double quotes can contain commas, line breaks, and doubled quotes ("") that stand for a real quote. The tool follows the common RFC 4180 rules, so those values stay in one piece.
What happens with blank or repeated column names?
A blank header becomes column1, column2, and so on, based on its position. A repeated header gets a number added, like email and email_2, so one column never overwrites another. If a row has more fields than the header, the extra fields get column names too.
How do I make nested JSON from a CSV?
Name your headers with dots, such as address.city and address.zip, and turn on "Nest dotted headers". Those columns become a nested address object in each record. It works with the array of objects and keyed outputs.
What is the largest CSV I can convert?
Files up to 25 MB. Files over 1 MB are converted without being shown in the input box, and very large results show only the start of the JSON on screen. Copy and download always give you the full JSON.
Can it convert JSON back to CSV?
This page only goes from CSV to JSON. To go the other way, use the JSON to CSV Converter, which converts in both directions.
Is my CSV uploaded anywhere?
No. The file is read and converted in your browser, so your data never leaves your device. The tool is free with no signup.