Convert CSV to JSON: Keep Types and Headers Right
Convert CSV to JSON free with auto delimiter detection, typed numbers and booleans, duplicate-header handling and 2/4-space or tab output. Runs in browser.
To convert CSV to JSON, paste the CSV into the box, choose a delimiter or leave auto-detect on, and press Convert. The tool uses the first row as object keys, recognises numbers, booleans and nulls, handles quoted fields with embedded commas and newlines, and returns an array of objects. The conversion happens in your browser.
That last detail is why it can be used on exports that contain customer data. The CSV is not uploaded; the parsing and JSON generation run locally, and the input cap is 500,000 characters.
What the converter does
The parser follows the usual CSV quoting rules: a field wrapped in double quotes may contain the delimiter or a line break, and a doubled quote inside a quoted field becomes one literal quote. Line endings can be LF, CRLF or bare CR, and blank lines are ignored rather than turned into empty rows.
Each data row becomes an object keyed by the header row. Values are then typed conservatively:
| CSV cell | JSON value |
|---|---|
42 |
42 |
-3.5 |
-3.5 |
true / false (any case) |
true / false |
null (any case) |
null |
| empty cell | "" |
007 |
"007" |
1e5 |
"1e5" |
hello |
"hello" |
The leading-zero rule is the one that saves real work. A product code, ZIP code or phone number like 01234 is text, not the number 1234, and the converter keeps it as a string. Exponent notation is also left as text, because it is rare in CSV exports and ambiguous to round-trip.
How to convert CSV to JSON
- Open the CSV to JSON converter.
- Paste your CSV into the input box.
- Choose the delimiter, or leave Auto-detect on. Comma, semicolon, pipe and tab are supported.
- Leave First row is a header checked if the first row contains column names. Uncheck it to get an array of arrays instead.
- Choose indentation: 2 spaces, 4 spaces or a tab.
- Press Convert.
- Copy the JSON, or download it if you need a file.
The result reports the row count, column count, detected delimiter and the number of cells that were converted to a non-string type.
Header handling
The header row is not just copied; it is made safe for use as JSON keys:
- Whitespace is trimmed from names.
- Blank headers are filled with a positional name.
- Duplicate headers get a suffix, so two columns called
namedo not silently overwrite each other. - Missing cells in short rows become empty strings, and the result notes how many rows were ragged.
If you uncheck the header option, each row becomes an array. That is the right output when the first row is data, or when the file has no header at all.
Auto-detection and delimiters
Auto-detect does not just count commas. It parses the sample with each candidate delimiter and keeps the one that produces the most consistent, widest rows. That matters for European exports that use semicolons, and for files where a comma inside a quoted address would otherwise win the vote.
If detection gets it wrong, pick the delimiter explicitly. A wrong delimiter usually shows up immediately as a single column containing the whole line.
Common problems and fixes
Everything landed in one column. The delimiter is wrong. Choose comma, semicolon, pipe or tab explicitly, or check whether the file uses a different character.
Leading zeros disappeared. They should not: numbers with leading zeros are kept as strings. If they vanished, the source may already have been opened and saved by a spreadsheet that converted them to numbers.
A quoted field split into two columns. An unescaped quote inside a field breaks the quoting. In CSV, a literal quote inside a quoted field must be doubled (""). Fix the source or pre-process it.
Rows have different widths. Missing trailing cells become empty strings and the result reports the count. A stray delimiter inside an unquoted field is the usual cause.
The first header has a strange character. A UTF-8 byte-order mark can attach to the first header name. Save the file without a BOM, or rename the key after conversion.
The JSON is rejected or the input is too large. The limit is 500,000 characters. Split the file or pre-filter the columns.
Numbers arrived as strings. The value had a leading zero, an exponent, a currency symbol, or a thousands separator. Clean the column before converting if you need real numbers.
Dates are strings. That is intentional. CSV has no date type, and guessing between 03/04/2025 and 2025-03-04 is how data gets silently corrupted. Parse dates in your application with a known format.
Tips for a clean conversion
- Keep the header row. It produces self-describing objects and makes the JSON usable without a separate schema.
- Clean the export first. Remove title rows, footers and merged-cell artifacts; they are not data rows.
- Use tab for TSV. Auto-detect usually finds it, but an explicit choice is safer when the file is mixed.
- Watch
nullas a literal value. A product actually named "null" will become JSONnull. Quote or rename it if that is a real value. - Check the typed-value count. A high count is normal for numeric data; a suspiciously low one suggests numbers are arriving as strings.
- Convert back if you need a spreadsheet. The JSON to CSV converter reverses the direction, including flattened nested objects.
- Format the result before sharing. The JSON formatter validates and pretty-prints if you need a second pass.
CSV vs JSON for data exchange
CSV is simple and universal, but it is flat. It has no types, no nesting and no standard for null versus empty. JSON carries structure and types, which is why it is the better fit for APIs and application state.
The conversion loses nothing that CSV had, but it cannot invent nesting that was not there. If your CSV encodes a relationship in column names like address_city and address_zip, you can convert and then restructure the objects in code. The converter keeps the flat keys; it does not infer a hierarchy from underscores.
For a quick inspection, the reverse direction is often more useful: paste JSON, generate a CSV, and open it in a spreadsheet to sort and filter. That workflow is why both tools exist.
Frequently asked questions
Is the CSV to JSON converter free?
Yes. There is no account and no charge.
Is my CSV uploaded?
No. The conversion runs in your browser, and the input is not stored.
Does it detect the delimiter automatically?
Yes. Auto-detect is the default and handles comma, semicolon, pipe and tab. You can also choose a delimiter explicitly.
Are numbers and booleans converted to real JSON types?
Yes, conservatively. Integers and decimals become numbers, true/false become booleans, and null becomes null. Values with leading zeros, exponents or other non-numeric characters stay strings.
What happens if rows have different numbers of columns?
Missing cells become empty strings, and the result reports how many rows were ragged. A stray delimiter inside an unquoted field is the usual cause.
Can I convert CSV without a header row?
Yes. Uncheck "First row is a header" and the output becomes an array of arrays instead of an array of objects.
Bottom line
A good CSV conversion is mostly about the details: the right delimiter, safe header names, and numbers that do not lose their leading zeros. This tool handles those by default and tells you what it changed. Start with the CSV to JSON converter, check the row and typed-value counts, and move to the JSON to CSV converter when you need to go the other way.
Related posts
View allIBAN Validator: Check an IBAN Before You Send Money
One mistyped character can bounce a payment. Check the country, length and mod-97 checksum of an IBAN before you send it.
Base64 Encode and Decode: A Practical Guide
Encode text to Base64 or decode it free in your browser. UTF-8 safe, line breaks tolerated, size and character counts shown, with errors on invalid input.
Decode a JWT Online: Header, Payload and Expiry
Decode a JWT online free. See the header algorithm, payload claims, expiry status in UTC and a readable claim summary. Decoding happens in your browser.
Comments (0)
Be the first to share feedback on this post.