Blog

How to Convert CSV to JSON Online

Published August 2026 · Toolsyy Team

Someone sends you a spreadsheet; your code wants JSON. Toolsyy’s CSV to JSON converter does the translation in your browser — no upload, which matters when the spreadsheet is a customer list. CSV looks trivial and isn’t, so this guide covers the three things that actually go wrong.

The basic conversion

Given a file like this:

name,role,years
Ada,Engineer,7
Grace,Admiral,42

you get an array of objects, one per row, keyed by the header:

{"name": "Ada", "role": "Engineer", "years": 7}

If your file has no header row, untick First row is a header and each row becomes a plain array instead.

Trap 1: the leading zero

This is the one that quietly corrupts data, and most converters get it wrong.

A naive converter turns anything that looks numeric into a number. So a zip code of 007 becomes 7. A phone number of 0123456789 becomes 123456789. A product code of 0042 becomes 42. The leading zero is gone, the value is wrong, and nothing warns you — the JSON is perfectly valid, just incorrect.

Toolsyy’s type detection is deliberately strict. A value becomes a number only if it is a well-formed number with no leading zero. That means:

  • 42 → number
  • -3.5 → number
  • 007string, unchanged
  • +44 20 7946string, unchanged
  • true / false → boolean
  • empty cell → null

If you want everything kept as text, untick Detect numbers and booleans. For identifiers — order numbers, account references, postcodes — that’s often the safest choice, since they’re only ever compared, never added up.

Trap 2: semicolons

Open a CSV exported by Excel in Germany, France, Spain or Brazil and you’ll often find semicolons where you expected commas. There’s a good reason: in those locales the comma is the decimal separator, so 3,14 is the number pi. Using commas as field separators too would make the file ambiguous, so Excel switches to semicolons.

The converter detects the delimiter by counting candidates outside quoted sections — so a comma inside "Smith, John" doesn’t get a vote. Comma, semicolon, tab and pipe are all recognised, and you can set it manually if a small or unusual file fools the guess.

Trap 3: quotes and embedded newlines

CSV has a real specification — RFC 4180 — and the parts people forget are the parts that break naive parsers that just split on commas and newlines:

  • A field wrapped in quotes may contain the delimiter: "Smith, John" is one value.
  • A doubled quote inside a quoted field means one literal quote: "He said ""hi""" reads as He said "hi".
  • A quoted field may contain line breaks. A single record can span several lines of the file, which is why splitting on newlines produces garbage on any file containing a multi-line address or comment.

All three are handled correctly.

Going the other way

Need JSON turned back into a spreadsheet? That’s the JSON to CSV converter, and there’s a separate guide for it. One thing worth knowing: when writing CSV, Toolsyy neutralises values beginning with =, + or @, because spreadsheets treat those as formulas — a genuine security issue known as CSV injection.

FAQ

Why does my CSV use semicolons instead of commas?

In countries where the comma is the decimal separator, such as Germany, France and Brazil, Excel exports CSV with semicolons so that numbers like 3,14 are not mistaken for two fields. The converter detects the delimiter automatically, and you can override it if the guess is wrong.

Will a zip code like 007 stay a string?

Yes. Type detection is deliberately strict: a value only becomes a number if it has no leading zero and no other characters. So 007 and 0123456789 stay strings and keep their exact form, while 42 and -3.5 become real numbers.

Can it handle commas inside a quoted field?

Yes. The parser follows RFC 4180, so a quoted field such as "Smith, John" is read as one value, a doubled quote inside a quoted field means a literal quote character, and a quoted field may even contain line breaks.

What happens if a row has fewer columns than the header?

The missing keys are still present in the resulting object, set to null. That keeps every object the same shape, which is what most code consuming the JSON expects.

Related guides

Try it now: Free CSV to JSON Converter