Back to Tools

CSV to JSON Converter

Auto-detect headers, convert rows to JSON objects with type inference

🔍 Auto Headers🔢 Type Inference
CSV Input

Turn spreadsheet rows into JSON objects

CSV is what spreadsheets and database exports give you; JSON is what APIs, front-end code and NoSQL databases expect. This converter takes CSV text you paste into the box, uses the first row as field names, and produces a JSON structure you can copy or save. The conversion runs in your browser through JavaScript on the page.

Converting your data, step by step

  1. Paste your CSV into the CSV Input box. The Paste button reads from your clipboard, and Sample loads a small example with id, name, email, age, premium and score columns.
  2. Pick the Delimiter: comma, semicolon, tab or pipe.
  3. Choose the Output shape. Array of Objects gives a list of records; Keyed Object gives one object whose keys are the row positions 0, 1, 2 and so on.
  4. Leave First row = Headers ticked if the top line holds column names, and decide whether Infer Types should stay on.
  5. Set the Indent to 2 spaces, 4 spaces or Minified, then press Convert to JSON.

A summary bar shows the row count, column count and output size in bytes. Use Copy or the JSON download button, which saves a file named output.json.

How type inference behaves

With Infer Types on, the words true and false become booleans, numeric text becomes a number, and empty cells or the word null become null. Everything else stays a string. Turn it off when every value must remain text, for example postcodes, phone numbers or product codes with leading zeros, since a value such as 007 would otherwise turn into 7.

When there is no header row

Untick First row = Headers and the tool names the fields col1, col2, col3 and so on, and treats every line as data.

Where this helps

Limitations worth knowing

Quoted fields containing the delimiter or escaped double quotes are handled, but the parser reads the input line by line, so a quoted cell that spans several lines will be split apart. Empty lines are skipped. If the header row contains duplicate names, later columns overwrite earlier ones in each object. Rows with fewer cells than headers get null values for the missing fields when inference is on, and extra cells beyond the header count are ignored. Whitespace around each value is trimmed.

Related Tools




Frequently Asked Questions

Why did my postcode or ID lose its leading zeros?
That is the Infer Types option at work: text that looks numeric, such as 00123, is converted to the number 123. Untick Infer Types before converting and every value is kept as a string exactly as it appears, leading zeros included.
What is the difference between Array of Objects and Keyed Object?
Array of Objects returns a JSON list with one object per row, which most APIs and libraries expect. Keyed Object returns a single object where each row sits under its position number as the key, starting at 0.
Can I convert a CSV that uses semicolons or tabs?
Yes. Use the Delimiter menu to choose comma, semicolon, tab or pipe before pressing Convert to JSON. The selection is not detected automatically here, so choose the one that matches your file or the columns will not split correctly.
What happens if my CSV has no header row?
Untick First row = Headers. The converter then generates field names col1, col2, col3 and so on, and every line of your input, including the first, becomes a JSON object. Field names are then assigned by column position.
Does it handle commas inside quoted values?
Yes, a quoted value such as "Smith, John" is kept together as one field, and doubled quotes inside it become a single quote. The limit is line breaks: a quoted cell that contains a newline will be treated as separate rows. The nested structure is otherwise identical to the standard array output.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.