Skip to tool
ecech.
💻 Developer & Code

CSV to JSON That Keeps 007 as a String Instead of Turning It Into 7

Leading zeros are identifiers, long digit strings lose precision as numbers, and 03/04/2026 has two readings. This infers types and knows where to stop.

JSON



Type decisions

Advertisement

How the calculation works

Three values that must stay strings "007" 7 a postcode or product code, destroyed "9007199254740993" ...992 last digit changed, silently "03/04/2026" ? 3 April or 4 March — the file does not say All three convert without error. All three are wrong afterwards. This converter leaves them as strings and tells you it did.

How to Use This Tool

Paste CSV, get JSON. Type inference is on by default and deliberately conservative — the decisions panel lists everything it changed and everything it refused to.

What gets converted

  • Numbers42, -3.5, 91.5. Only when the value is a plain number with no leading zero and short enough to hold exactly.
  • Booleanstrue and false, case-insensitively. Note that yes, Y and 1 are not converted, because in a lot of data those mean something other than boolean true.
  • Empty cells — left as empty strings by default rather than null, since CSV genuinely cannot distinguish "empty" from "missing".

What is deliberately left alone

Leading zeros. 007, 0420, 01234 are almost always identifiers — postcodes, product codes, phone numbers, account numbers. Converting them to numbers strips the zeros and the value cannot be recovered, because nothing records how many there were. This is the single most common way a spreadsheet destroys a dataset.

Long digit strings. A JavaScript number holds integers exactly only up to about 9,007,199,254,740,991. Beyond that, digits are lost silently: convert 9007199254740993 and you get ...992 back. Since IDs from Twitter, Discord, Snowflake schemes and many databases are 18 or 19 digits, any converter that eagerly parses them corrupts your keys. They stay strings here.

Dates. 03/04/2026 is 3 April to most of the world and 4 March in the United States, and there is nothing in the file to say which. Guessing gives you data that is wrong about half the time and looks entirely normal. Dates are left as written; if you need them typed, convert with knowledge of the source, which the file does not contain.

Where a JavaScript number stops counting 9007199254740991 the largest exact integer 9007199254740993 9007199254740992 Snowflake, Discord and Twitter IDs are 18 to 19 digits. Parsing them as numbers changes them, with no error and no way to notice later.
An ID that changes when you read it is worse than an ID you did not parse.

Parsing, not splitting on commas

A CSV field can contain the delimiter, quotes and newlines as long as it is quoted, so splitting each line on commas breaks on real files. This uses a character-by-character parser that tracks whether it is inside quotes, handles doubled quotes as a literal quote, and accepts newlines inside quoted fields.

The delimiter detector counts commas, semicolons and tabs outside quotes on the first few lines and picks the most consistent one. European exports frequently use semicolons, because the comma is the decimal mark there.

If types matter, CSV was the wrong format

None of this is a criticism of the tool that produced your file. CSV has no type system at all, so every reader has to guess, and different readers guess differently. If you control both ends, JSON Lines or Parquet carry types explicitly and remove the entire class of problem. Where you do not, a conservative converter that tells you what it did is the next best thing.

Advertisement

Frequently Asked Questions

Why does my CSV lose leading zeros when converted?
Because the converter treated 007 as the number 7. Leading zeros almost always mean the value is an identifier — a postcode, product code or phone number — and once converted the zeros cannot be recovered, since nothing records how many there were. This tool keeps such values as strings.
Why do long ID numbers change when converted to JSON?
Because JavaScript numbers hold integers exactly only up to about 9,007,199,254,740,991. Above that, digits are lost silently: 9007199254740993 becomes ...992. Snowflake, Discord and Twitter IDs are 18 or 19 digits, so any eager converter corrupts them. They are kept as strings here.
How should dates in CSV be handled?
Left alone unless you know the source. 03/04/2026 is 3 April in most of the world and 4 March in the United States, and nothing in the file distinguishes them. Guessing produces data that is wrong roughly half the time and looks completely normal, which is the worst kind of wrong.
Why aren't yes and 1 converted to booleans?
Because they frequently mean something else. A column of 1 and 0 might be a boolean, or a count, or a status code, and 'Y' might be an initial. Only the literal words true and false are unambiguous enough to convert safely; anything else is a guess about your data's meaning.
Can CSV fields contain commas and newlines?
Yes, when the field is quoted — that is what quoting is for. It also means splitting each line on commas breaks on real files. This uses a proper parser that tracks quote state, treats a doubled quote as a literal quote, and allows newlines inside quoted fields.
How is the delimiter detected?
By counting commas, semicolons and tabs outside quotes across the first few lines and picking the one that appears most consistently. European exports often use semicolons because the comma is the decimal mark there. You can override the detection if it gets it wrong.
Is my CSV uploaded anywhere?
No. It is parsed and converted in your browser and nothing is transmitted.

Related tools in Developer & Code

Browse all Developer & Code tools
The desk where ecech. tools get written: a laptop, a notebook of to-dos and a whiteboard listing the tools on the site.

Made by one person

ecech. is not a content farm. Every tool here is written and checked by hand, one at a time, by someone who wanted the tool to exist and could not find a version that showed its working.

No accounts and no sign-in, and nothing you type reaches a server — every calculation on this page runs inside your browser. The ads are served by Google and do set their own cookies, which is set out in full on the privacy page. More about the site.