Saved

Press the star next to a tool's name to save it.

All my tools

CSV to JSON Converter

Paste CSV data to turn it into JSON. It handles quoted values and common separators, and you can copy or download the result. Nothing you paste is uploaded.

Restored your last values ·

Your result opens on the next page.

Your data stays on this device. It’s never uploaded or saved.

Your JSON

2 records

Paste your CSV to see the JSON.

Recent results

How the conversion works

Each line of your CSV becomes one JSON object, and the first line supplies the names. So this CSV:

name,age
Jane,34

becomes this JSON:

[{"name": "Jane", "age": 34}]

Your options

OptionWhat it does
SeparatorAuto looks at your first line. You can also choose comma, tab, semicolon or pipe
First row is headingsTurn this off if your data has no headings, and columns become column1, column2 and so on
Convert numbers and true/falseMakes 34 a number instead of the text "34"
FormatIndented for reading, or minified for size

Quotes and special cases

  • Commas inside a value: quote the value, such as "Portland, OR".
  • Quotes inside a value: double them, such as "She said ""hi""".
  • Line breaks inside a value: these work inside quotes too.
  • Missing values: a short row fills the missing cells with empty text.
  • Repeated or blank headings: they get names of their own, such as name_2 or column3, so no data gets overwritten.

Why some numbers stay as text

Values such as ZIP codes and IDs can start with zeros, as in 02134. Turning them into numbers would lose those zeros, so they stay as text. Very long numbers, numbers with commas and dollar amounts stay as text too. Turn off conversion to keep everything as text.

Is my data private?

Yes. The tool runs in your browser, so nothing you paste is uploaded or stored.

Need to check or tidy your JSON? Try the JSON formatter. To change spreadsheet formats, use the Excel converter.

How to use the CSV to JSON converter

  1. Paste your data. Put it in the Your CSV data box. A short sample is there to start with, so you can see how it works. Press Clear to empty the box and set every option back to its default.
  2. Check the separator. Detect automatically picks whichever of comma, tab, semicolon or pipe appears most often in your first line. If your first line is unusual, choose the separator yourself.
  3. Pick a format. Under Format, choose 2 spaces or 4 spaces for JSON that is easy to read, or Minified for one compact line.
  4. Set the two checkboxes. Leave First row is headings on if row one holds column names. Leave Convert numbers and true/false on to get real numbers and booleans.
  5. Press See result. You get the JSON, the number of records, and buttons to copy it or download it as data.json.

Worked example: a semicolon file from a spreadsheet

Some CSV files use semicolons between values and a comma as the decimal mark. Paste this one:

id;price;in_stock
00123;3,50;TRUE
00124;12.5;false

Detect automatically picks the semicolon, and you get two records, shown here in short form:

[{"id": "00123", "price": "3,50", "in_stock": "TRUE"},
{"id": "00124", "price": 12.5, "in_stock": false}]

Look at what stayed as text. Both IDs keep their leading zeros. The price 3,50 stays text, because a comma isn’t read as a decimal point, while 12.5 becomes a number. Only lower-case true and false become booleans, so TRUE in capitals stays text. If you need 3,50 as a number, change it to 3.50 in your spreadsheet before you export.

What the JSON can hold

JSON has four basic types, strings, numbers, booleans and null, plus objects and arrays.[2] This tool makes an array with one object per row. Every value is a string, a number or true or false. An empty cell becomes empty text, and the word null stays as the text "null".

JSON doesn’t allow numbers with leading zeros, which is one more reason 02134 has to stay a string.[2] Numbers are also limited in how exactly other programs can read them. The JSON standard says programs that expect no more precision than common double-precision numbers will work well together.[2] So the tool turns values of up to 15 digits before the decimal point into numbers and keeps longer ones, such as card numbers or long IDs, as text so no digit is rounded away.

Spaces, short rows and repeated headings

CSV treats spaces as part of a field, so they should not be ignored.[1] The tool follows that rule. A cell written as “ 34” with a space in front keeps the space and stays text. Remove stray spaces in your spreadsheet if you want those cells as numbers.

Each line of a CSV file should have the same number of fields.[1] When a row is short, the missing cells become empty text. When a row is longer than the headings, the extra cells get names such as column5. Names inside a JSON object should be unique, as programs can behave unpredictably when they repeat.[2] That is why a second “name” column becomes name_2.

Common CSV to JSON mistakes

  • Expecting ZIP codes to stay text. Only codes that start with zero stay text. A code such as 90210 becomes a number. Turn off Convert numbers and true/false to keep every value as text.
  • Leaving a quote open. One missing closing quote turns the rest of the data into a single cell, so the tool shows an error instead.
  • Turning off the headings by mistake. Your column names then become a record of their own, and the keys are column1, column2 and so on.

To go the other way, use the JSON to CSV converter.

What next

Use this often? Add CSV to JSON to your Home screen.

Frequently asked questions

How do I convert CSV to JSON?

Paste your CSV in the box. Each row becomes a JSON object, using the first row for names. Then copy or download the result.

Can it handle commas inside values?

Yes, if the value is in double quotes, as CSV expects. For example, "Portland, OR" stays as one value.

Why is my ZIP code still text?

Numbers that start with zero stay as text, so the zero isn’t lost. That keeps values such as 02134 correct.

Is my data sent anywhere?

No. It all runs in your browser, so what you paste stays on your device.

Why did 90210 become a number but 02134 stay text?

Numbers that start with zero stay text so the zero isn’t lost. A code like 90210 has no leading zero, so it becomes a number. Turn off Convert numbers and true/false to keep every value as text.

Can it read semicolon or tab separated files?

Yes. Detect automatically picks comma, tab, semicolon or pipe from your first line, or you can choose the separator yourself.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools