CSV to JSON Converter — Preserve Leading Zeros
Convert CSV to JSON in your browser. Preserve leading zeros as strings, handle quoted commas and newlines, and download JSON. No signup required.
Loading the tool… JavaScript is required for processing on your device. The instructions and examples below are available without JavaScript.
How to use it
Paste comma-separated data with a unique header for every column.
Good to know
Quoted commas and line breaks are supported. Values remain strings to preserve IDs and leading zeros.
Preserve leading zeros in CSV-to-JSON conversion
Schwapps keeps every CSV value as a JSON string. That means identifiers such as 00901 keep their leading zeros instead of becoming the number 901.
CSV input
customer_id,postal_code,name
00042,00901,AdaJSON output
[
{
"customer_id": "00042",
"postal_code": "00901",
"name": "Ada"
}
]JSON numbers cannot preserve leading zeros. Strings can. This converter also leaves amounts and values such as true as strings; it does not guess data types. If another system requires numbers or booleans, convert the appropriate fields deliberately after checking its requirements.
What if Excel already removed the zeros?
Check the CSV text before converting. If it already contains 901, this tool cannot know whether the original was 00901 or 0901. Start from an export that still contains the complete identifier.
Quoted commas, quotation marks, and newlines
Wrap a field containing a comma or a line break in double quotes. Inside a quoted field, represent one double quote with two double quotes. For example, this CSV preserves both the comma and the quotation marks:
name,note
Ada,"Hello, ""team"""
The note becomes the JSON string "Hello, \"team\"" with the internal quotes escaped in the output. Quoted fields can also contain actual line breaks; the JSON output represents those as escaped newline characters.
Before you convert
- Use comma-separated CSV with a header row. Header names must be nonempty and unique after surrounding spaces are removed.
- Each nonempty data row must have the same number of fields as the header.
- Semicolon-separated files, headerless data, and nested JSON structures are not supported.
- Paste at most 100,000 characters. The parser also limits input to 10,000 CSV rows including the header.
Run the tool, inspect the result, then copy it or download a .json file. Your input is processed locally in your browser.