Skip to content
cliplimeClipLime

Convert CSV to JSON

Paste a CSV or drop a file and get clean JSON, with numbers, quotes and delimiters sorted out for you.

Runs on your device, nothing is uploaded

Convert from

to

Paste, type, drop a file here or load one.

0 characters, 0 lines

Options

When off, columns are called column1, column2 and so on.

A column becomes numbers only if every filled cell in it is a clean number. All types also reads true/false, and empty cells and the words null and NULL become null.

Columns such as address.city become nested objects, and tags.0, tags.1 become a list.

Write each row as

A list per row starts with the column names when they are on.

Indentation

More options

The dot in address.city.

Empty cells do not create a key.

At a glance

Input
CSV or TSV text and files, with commas, semicolons, tabs or pipes. The delimiter is detected, and you can set it yourself.
Quotes
Quoted values, doubled quote marks and line breaks inside cells are kept exactly.
Header
The first row gives the keys. Turn it off to get column1, column2 and so on.
Types
Numbers, true and false, and empty cells (null) are detected per column, or you can keep everything as text.
Nested JSON
Headers such as address.city become nested objects, and tags.0 and tags.1 become a list.
Output
A list of objects or a list of lists, with the indentation you choose. Copy it or download a .json file.
Privacy
Your CSV is converted in your browser tab and never uploaded.

How to do it

  1. 1

    Add your CSV

    Paste it, drop a file on the input box, or press Load a file. The delimiter is detected, and files that Excel saved as Windows-1252 are read correctly.

  2. 2

    Choose how to read it

    Keep First row has the column names on if the first row is a header. Pick whether numbers and true and false become real JSON values or stay text.

  3. 3

    Pick the shape

    Write each row as an object, which is the usual choice, or as a list. Turn dotted headers into nested objects, or keep them as flat keys.

  4. 4

    Copy or download

    Copy the JSON or download a .json file. The notes under the result list anything that was assumed.

What a CSV file really is

CSV looks simple, but real files vary. A value that contains the delimiter, a quote mark or a line break is wrapped in double quotes, and a quote mark inside it is written twice, as in "She said ""hi""". In countries that write decimals with a comma, Excel uses a semicolon as the delimiter, so one person's CSV is another person's single column. Files saved by Excel as "CSV (Comma delimited)" are not UTF-8 (only its "CSV UTF-8" option is).

The converter detects the delimiter by trying a comma, tab, semicolon and pipe on the first rows and choosing the one that splits them into the same number of fields most consistently, ignoring delimiters inside quotes. It reads the encoding from the bytes, so accents survive. Rows with fewer values than the header are padded with empty cells, extra values go into extra columns called column5, column6 and so on, and a repeated header such as name, name becomes name, name_2. Rows with no content are skipped, except in a file with a single column, where a value written as "" is a row with an empty value.

A quote mark inside a quoted value has to be written twice. If one is not, as in "x"y,z, the value does not end there but runs on to the next closing quote, possibly over several lines, and a note names the line and column where it went wrong.

How numbers, true and false, and empty cells are typed

CSV has no types, so the converter decides one column at a time. A column becomes numbers only when every filled cell in it is a clean number. A column of true and false (in any capitalisation) becomes booleans. Empty cells become null. Anything else stays text.

  • 42 and -3.5 become numbers, and 3.50 is written as 3.5.
  • 007 and 02134 stay text, so IDs and ZIP codes keep their zeros.
  • 12345678901234567890 stays text, because a JSON number would be rounded after about 15 digits.
  • 1,5 and 1.234,50 stay text, because the same text means different numbers in different countries.
  • A column with 10, 20 and n/a stays text in every row, so a column never mixes numbers and words.

Choose Keep as text if you need every cell exactly as written.

Getting nested JSON out of a flat CSV

Name the columns by path and the converter builds the structure. The header name,address.city,address.zip,tags.0,tags.1 gives {"name": ..., "address": {"city": ..., "zip": ...}, "tags": [..., ...]} for each row. Empty items at the end of a list are dropped, and with Leave out empty cells under More options, empty cells do not create a key at all.

If you do not want nesting, turn off Rebuild nested values from column names and the headers stay as flat keys. A header is only taken as a path when every part between the dots is a real name, so headers such as No. of items, Dr. Smith or Amt. (a space next to the dot, or a dot at the end) stay plain keys. If the dot is part of other column names, such as v1.2, pick a different separator under More options. Choose A list to get one JSON list per row, with the column names as the first list.

Questions people ask

Why are my numbers strings in the JSON?

Either number detection is off, or one cell in that column is not a clean number. A single n/a, a value with a thousands separator, a leading zero or more than 15 digits keeps the whole column as text. Set Cell values to Detect numbers, or Detect all types, and look for the stray value.

How do I get nested JSON from a CSV?

Use dotted column names such as address.city, and numbered ones such as tags.0 and tags.1 for a list. With Rebuild nested values from column names on, each row becomes a nested object.

My file uses semicolons or tabs. Will it work?

Yes. The delimiter is detected from the first rows, and you can choose it yourself under Delimiter in the input if the guess is wrong, for example for a file with only one or two columns.

Can I convert a CSV that has no header row?

Turn off First row has the column names. The keys become column1, column2 and so on, or choose A list to get one list per row with no keys at all.

How are empty cells written?

With Detect all types they become null, in text columns too, and the exact words null and NULL become null as well. With Detect numbers only empty cells in a number column become null, and with Keep as text they stay empty strings. Leave out empty cells under More options drops the key altogether.

Is my CSV uploaded?

No. The file is read and converted in your browser tab, so private data stays on your device.