Skip to content
DevToolsCave

    This tool runs entirely in your browser. Nothing you paste is uploaded.

    How you can check →
    JSON

    CSV to JSON

    Convert CSV or TSV into JSON in your browser. The delimiter is detected for you, and values only become numbers when they can survive the trip back.

    JSON
    The JSON appears here.

    The rule that decides what becomes a number

    Every CSV-to-JSON converter has to guess at types, because CSV has none: a cell containing 007 is just three characters, and the file does not say whether that is a number or a code. Guessing wrong is not a cosmetic problem — it permanently destroys data, and it does so silently.

    This tool uses one rule, stated so you can check it yourself: a cell becomes a number only when writing that number back out produces the exact characters the cell contained.

    • 42 becomes the number 42 — writing 42 back gives "42".
    • 007 stays text — writing 7 back gives "7", so the padding would be lost.
    • 1.20 stays text — writing 1.2 back drops a digit that was deliberate.
    • +1 and .5 stay text — neither is valid JSON number syntax.
    • 12345678901234567890 stays text — no JSON number can hold it exactly, so emitting it unquoted would corrupt it in whatever reads the result.

    true and false become booleans. The word null does not become null: in a real column it is far more often a literal value than a marker for absence, and that guess is unrecoverable. Turn detection off entirely and every value stays a string, which is what you want when the JSON feeds a schema that will do its own coercion.

    Delimiters and quoting

    The delimiter is detected by parsing the first lines of your file with comma, semicolon, tab and pipe, and choosing whichever produces a consistent column count — so a European semicolon-separated export or a tab-separated dump works without you telling it anything. A commented reading of the file is not enough on its own, because commas inside quoted fields would fool a simple count; the sniffing does a real parse for each candidate.

    Quoted fields follow RFC 4180: they may contain the delimiter, line breaks, and doubled quotes to represent a literal quote. Byte-order marks are stripped, so the first column is not given an invisible character in its name that stops it ever matching.

    Where it refuses rather than guesses

    • A row with more fields than the header stops the conversion, naming the line and the two counts. Silently shifting values into neighbouring properties would produce a completely plausible, completely wrong result.
    • A duplicated header name stops it too — a JSON object cannot hold the same property twice, so one column would have to disappear.
    • An unnamed header column is an error, because the property would have no name.
    • A row with fewer fields is filled and produces a warning; that case is unambiguous, so it is not worth stopping for.

    Frequently asked questions

    Why is my product code 007 still a string?
    Because writing the number 7 back out gives "7", not "007", so the leading zeros are information a number cannot carry. This tool only converts a cell to a number when the number reads back as the exact characters the cell contained. That single rule is why zero-padded codes, phone numbers and version strings survive here and get mangled elsewhere.
    Why did a long number stay text?
    A JSON number is a 64-bit float, which cannot hold integers beyond 9,007,199,254,740,991 exactly. Writing a 20-digit ID as a bare number would produce a document that changes the moment anything parses it, so it is quoted instead and you get a warning explaining why.
    Which delimiters are supported?
    Comma, semicolon, tab and pipe. The delimiter is detected automatically by parsing the first lines with each candidate and picking the one that yields a consistent column count, so European semicolon CSVs and TSV files work without configuration. You can always override the guess.
    What happens to quoted fields and embedded newlines?
    They are handled per RFC 4180: a quoted field can contain the delimiter, line breaks and doubled quotes, and the parser tracks the real line number across them so any error message points at the right place in your file.
    What if a row has more fields than the header?
    The conversion stops with an error naming the line and both counts. There is no way to know which column the extra values belong to, and guessing would shift every value in the row into the wrong property — a wrong answer that looks completely plausible. Rows with fewer fields are filled and you get a warning.