Checking CSV text that resembles numbers, booleans or null
The CSV converter keeps every field as text. A field that reads 12, true or null comes out as the string "12", "true" or "null", and this guide shows how to see the difference against real JSON types.
CSV carries text and no types
A CSV file is a sequence of characters arranged in records and fields. Nothing in the format says that one field is a number and another is a date. RFC 4180 describes fields as text separated by commas and says nothing about types. When a person looks at 12 in a spreadsheet cell, they see a number because the application guessed or because the cell was formatted that way. The file on disk holds the two characters 1 and 2. A converter that keeps that text as it is has made no claim about meaning. This one does exactly that: it parses the structure, builds one JSON object per record, and writes each field value as a JSON string, which is the faithful representation of what was in the file.
The first case: three words that look like types
The header is number,flag,empty and the single data record is 12,true,null. In JSON these three spellings could be a number, a boolean and the null value. The converter output shows "12", "true" and "null", each in quotation marks, so the quotation marks are the visible signal that they are strings. The key named empty is a useful trap: the text null in a CSV field is four characters, and an application that reads it as JSON null would be applying a convention that the CSV file never stated. An actually empty field would be a different input, and the converter would return an empty string for it, not null.
The control: a document that really has types
The second case runs a JSON document through the JSON validator and formatter with the indent set to zero. The input has the number 12 with no quotes, the literal true and the literal null, and the formatted output keeps them just as they were. This is the contrast the guide is built around. In JSON, quotation marks decide the type: 12 is a number and "12" is a string, true is a boolean and "true" is a string. JSON, as defined by RFC 8259, has exactly six value kinds: object, array, string, number, true or false, and null. CSV has one, which is text. Converting between them therefore needs an extra decision that the file itself cannot supply.
Why leaving strings alone protects data
Type guessing destroys information that matters. A postal code such as 02134 becomes the number 2134 and loses its leading zero. A product code 1E5 can be read as the number 100000. A long identifier of 17 or more digits can exceed what a double-precision number represents without rounding, since JavaScript numbers hold integers safely only up to 9,007,199,254,740,991. A person with the surname Null, or a field that literally records the word true as a survey answer, would be turned into a different kind of value. Keeping every field a string means none of these accidents happen during conversion, and any later interpretation becomes a visible, separate step that you can review.
Doing the conversion on purpose
If the receiving system needs numbers or booleans, apply a schema after the CSV conversion. A schema states for each column what the type is, what spelling is accepted, what to do with an empty value and what to do with a value that fails to parse. For a count column you might accept only digits and reject everything else. For a boolean column you might accept the words true and false in any letter case and refuse 1, yes and Y. The rules are yours to write, but they have to be written down somewhere. Libraries that infer types automatically are applying a schema of their own, and their guesses differ from tool to tool.
Spreadsheets and the same problem
Spreadsheet software shows the issue constantly. Opening a CSV file in a spreadsheet application runs type detection on every cell, so leading zeros vanish, long numbers turn into scientific notation and some gene names have famously been changed into dates. Saving the sheet back to CSV writes the converted values, which are no longer the original text. Working with a text-preserving converter avoids that round trip. If you must use a spreadsheet, import the file with every column set to text, which stops the detection step. The same principle underlies this guide: look at the characters first, and decide types afterward.
Reading the output correctly
When you check the converter output, look at the punctuation as much as the content. A value shown as "12" in quotes is a string, and a value shown as 12 without quotes would be a number. Every value in this converter's rows appears in quotes, including values that look like numbers. If you later paste the output into a program that does arithmetic on the field, expect to convert it first, and expect the conversion to fail for any entry that is not a valid number. A failed conversion on a single row is a useful signal that the column contained something unexpected, such as a unit suffix or a thousands separator.
Identifiers that must stay text
Some columns look numeric and are not quantities at all. Telephone numbers, ZIP codes, account numbers, ISBNs and part numbers are labels, and arithmetic on them has no meaning. Adding two phone numbers or averaging a postal code gives nothing useful, and converting them to numbers strips leading zeros and plus signs. A good rule for a CSV import is to ask of each column whether you would ever sort it by magnitude or add it up. If the answer is no, keep it as text through the whole pipeline. Quantities such as prices, counts and measurements are the columns worth converting, and only after you decide how to treat blanks, thousands separators and units.
Comparing the converter with a JSON formatter
The guide compares this converter with a JSON formatter, which parses a document that already has types. It does not rank formats or recommend always keeping strings. Typed output is convenient when the source schema is known and trusted, and wrong when it is guessed. The cases also do not cover quoted fields, embedded newlines or missing columns, which are separate parsing questions. The claim here is narrow: the converter does not infer types, and the quotation marks in the JSON output show that choice. Anything beyond that, such as how a downstream application treats the strings, depends on that application.
Reproduce the checks
Text-like values
Open the Csv To Json Converter and enter:
- CSV input
number,flag,empty 12,true,null- First row contains headers
true
Expected output:
Rows
[
{
"number": "12",
"flag": "true",
"empty": "null"
}
]The quotation marks identify JSON strings.
An actual typed JSON document
Open the Json Validator Formatter and enter:
- JSON input
{"number":12,"flag":true,"empty":null}- Indent
0
Expected output:
Formatted
{"number":12,"flag":true,"empty":null}These types are present in the JSON source itself.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08
- Primary definition and convention reference ↗ · 2026-10-08