CSV to JSON Converter

CSV Input
Settings
Rows
Values
JSON Output
Copied!

CSV files are the easiest way to export data from spreadsheets and databases, but web apps and APIs usually need JSON. The CSV to JSON Converter above turns a CSV table into clean JSON in seconds. It detects the delimiter, converts numbers and true/false values, handles quoted text and line breaks inside cells, and shows clear errors with the line number. It runs in your browser, so your data is never uploaded.

Table of Contents

CSV vs JSON

Feature CSV JSON
Structure Flat table of rows and columns Nested objects and lists
Data types Everything is text Text, numbers, true/false, null
Typical use Spreadsheets, exports, reports APIs, web apps, configuration

CSV has no single official standard. Most tools follow RFC 4180, an informational document that describes the common format: values separated by a delimiter, quotes around values that contain special characters, and two quotes ("") to write a quote inside a quoted value.

How to Use the CSV to JSON Converter

  1. Add your CSV. Paste it into the input box, or click Open File to load a .csv or .tsv file. Click Try Sample to see an example.
  2. Check the delimiter. Auto-detect works for comma, semicolon, tab and pipe. Choose one yourself if the result looks wrong.
  3. Choose your options. Set the output format, indentation and value conversion.
  4. Read the result. The JSON updates as you type, with the number of rows and columns. If something is wrong, a message shows the line number.
  5. Copy or download. Click Copy JSON or Download.

Settings Explained

Setting What it does
Delimiter The character that separates values. Auto-detect checks the first lines and picks the one that gives a consistent number of columns.
Output format Array of objects, array of arrays, or JSON Lines. See the examples below.
First row is the header Uses the first row as property names. If it is off, the columns are named column1, column2 and so on.
Skip empty lines Ignores blank lines between rows.
Trim spaces around values Removes spaces at the start and end of each value.
Convert numbers, true and false Turns suitable text into JSON numbers and booleans. Turn both off to keep every value as text.
Empty cells become null Writes null for empty cells instead of an empty string.

Output Formats

For this CSV:

id,name
1,Ann
2,Bob
  • Array of objects is the most common format for APIs: [{"id":1,"name":"Ann"},{"id":2,"name":"Bob"}]
  • Array of arrays keeps the table shape and includes the header row: [["id","name"],[1,"Ann"],[2,"Bob"]]
  • JSON Lines writes one object per line, which is useful for large files and data pipelines. See jsonlines.org.

How Values Are Converted

CSV value JSON result Why
42, 9.99, -5 Numbers Plain numbers are converted.
02134 "02134" (text) Leading zeros matter for zip codes, so the value stays text.
12345678901234567890 Text Numbers with more than 15 digits would lose precision as JSON numbers, so they stay text.
+5, .5 Text Only standard number formats are converted. Phone numbers such as +15551234 stay safe.
1.50 1.5 The number value is the same, but the trailing zero is not kept. Turn off number conversion if you need it.
true, TRUE, False Booleans Case does not matter.
Empty cell "" or null Depends on your setting.
Important! Check columns that look like numbers but are really identifiers, such as zip codes, order numbers or phone numbers. If the converter changes one of them, turn off Convert numbers, or keep a leading zero or plus sign in the source data.

Common CSV Problems and How to Fix Them

Problem Cause Fix
Everything is in one column The wrong delimiter. In many regions, spreadsheets export with semicolons. Choose the right delimiter, or use Auto-detect.
A quoted value is never closed A quote (") is missing at the end of a value. Add the closing quote, or write a quote inside a value as "".
A row has too many or too few values An unquoted delimiter inside a value, such as Smith, John. Put the value in quotes. The tool lists the affected rows.
Duplicate column names Two header cells have the same text. The tool renames them (name, name_2). Better, fix the header.
Strange characters in names The file uses a different text encoding. Save the CSV as UTF-8 and load it again.

Limitations to Know

  • CSV is flat. The output is a flat table, with no nested objects. To build nested JSON, convert first and restructure afterwards.
  • Types are guessed. CSV has no data types, so the tool uses simple rules. Review the result for ID-like columns.
  • Dates stay text. JSON has no date type.
  • Very large files. Conversion runs in your browser, so files of many megabytes may feel slow on older devices.
  • Extra values. A row with more values than the header gets extra properties named column4, column5 and so on.

Frequently Asked Questions

Is the CSV to JSON Converter free, and is my data uploaded?

It is free and needs no signup. The conversion runs in your browser, so your CSV stays on your device.

Why are all my values still text?

Check that Convert numbers and Convert true and false are on. Values with leading zeros, plus signs or more than 15 digits stay text on purpose.

Can it handle line breaks inside a cell?

Yes. If the cell is in quotes, line breaks, delimiters and doubled quotes inside it are read correctly. Line breaks become \n in the JSON text.

My CSV has no header row. What happens?

Turn off First row is the header. The columns are then named column1, column2 and so on, or you can choose the array of arrays format.

What is JSON Lines and when should I use it?

JSON Lines writes one JSON object per line instead of one big list. It suits large datasets, log files and tools that read data line by line.

Can I convert an Excel file?

Not directly. Save your sheet as CSV (UTF-8) from Excel or Google Sheets first, then load the CSV file here.

Final Thoughts

A CSV to JSON conversion is quick, but a few details decide whether the result is correct: the delimiter, the header row and the data types. Use Auto-detect, review the first rows of the output, and check columns such as zip codes before you use the JSON in your project.

Post a Comment