Skip to content
FmtTools

CSV to JSON Converter

A CSV reader that follows RFC 4180 rather than `split(",")`: quoted fields, embedded commas, newlines inside cells, doubled quotes, CRLF, BOM and a delimiter it works out from your data instead of assuming.

Delimiter

"comma (,)" scored highest (5 occurrences, 67% row consistency) but the counts vary, so set the delimiter explicitly.

Type inference

JSON shape

CSV or TSV input

Lines 6Bytes 205

JSON output

[
  {
    "id": 1,
    "name": "Anne Ås",
    "zip": "00420",
    "amount": 12.5,
    "joined": "2026-01-07",
    "score": "9007199254740993"
  },
  {
    "id": 2,
    "name": "Li, Wei",
    "zip": 90210,
    "amount": 7.25,
    "joined": "2026-02-28",
    "score": 3.5
  },
  {
    "id": 3,
    "name": "Gonzalo Ibáñez",
    "zip": 28001,
    "amount": null,
    "joined": "2026-03-01",
    "score": 4
  },
  {
    "id": 4,
    "name": "Multi\nline value",
    "zip": 10001,
    "amount": -3.75,
    "joined": "2026-04-15",
    "score": 2
  }
]
Records 4Columns 6Bytes 548

Parsed 5 record(s) into 6 column(s) with the "," delimiter

Line endings: LFBOM: noneQuoted cells: 2Cells with newlines: 1Ragged rows: 0Round trip: identical

Column typing decisions

Inference mode “safe”. A mixed column is one where the values do not agree, which usually means the file has a header inside the data or two record types merged.

ColumnInferredExamplesNullsMixed
idinteger1 · 20no
namestring0no
zipstring (mixed)90210 · 280010yes
amountnumber12.50 · 7.251yes
joinedstring0no
scorestring (mixed)3.5 · 40yes

2 value(s) were too large to be JSON numbers without rounding, so they were kept as strings. Switching inference to “aggressive” would not change that: the 53-bit mantissa limit is a property of the reader, not of this tool.

Spreadsheet risk in these values

Cells a spreadsheet application is likely to reinterpret if the file is opened by double-clicking rather than imported with per-column types.

  • zip · row 2 · 00420

    Leading zero dropped

    A number-typed cell stores 00123 as 123, which destroys zip codes, phone numbers, IBANs and part numbers.

    Fix: Force the column to text on import, or keep it quoted.

  • score · row 2 · 9007199254740993

    Precision loss / scientific notation

    Spreadsheets keep about 15 significant digits and switch longer values to 1.23457E+17, which also drops trailing zeros permanently.

    Fix: Import the column as text, or add ="…" quoting from the writer.

Parse report

0 error(s), 1 warning(s), 0 note(s).

SeverityWhereIssue
warningrow 2 · col 6Column "score" row 2: 9007199254740993 is a whole number above 2^53−1.Converted to a number it loses its last digits in JavaScript and any double-based backend, so it was left as a string. Keep identifiers as strings on purpose.
Rows
5
Columns
6
Distinct widths
1

More than 1 means ragged data

Ragged rows
0

Uniform

Quoted cells
2
Embedded newlines
1
Duplicate headers
0

None

JSON records
4

Parsing is a state machine, and typing is a decision

RFC 4180 defines a CSV file as records of fields separated by commas, with an optional header row, fields that may be quoted, and quotes inside a quoted field escaped by doubling. Because a quoted field may contain a comma *and* a line break, no implementation that splits on newlines and then on commas is correct. This tool is a single-pass state machine over characters, which is why a cell containing "Revenue, net\r\n2025" arrives as one value.

The delimiter is inferred by counting consistent occurrences of comma, tab, semicolon and pipe across the first records, and the reason it chose one is printed — so a semicolon file exported from a European locale is not silently converted into one enormous column.

Turning text into typed JSON is where corruption happens, so it is explicit and auditable. Each column gets a reported inferred type, example values, a null count and a mixed flag when the column refuses to be one thing. Numbers above 2^53 − 1 are kept as strings regardless of the mode, because a JSON number that overflows a double is a data-loss event.

Conversion controls and diagnostics

  • Automatic delimiter detection with the reason reported
  • RFC 4180 double-quote escaping and a backslash alternative
  • Header row on or off, with generated keys when off
  • Array-of-objects, array-of-arrays or object-of-arrays output
  • Type inference off, safe or aggressive
  • Empty versus null controlled by an explicit null-token list
  • Ragged row, duplicate header and blank header reporting
  • Precision-loss guard for identifiers above 2^53 − 1
  • Spreadsheet damage audit listing risky cells and the fix
  • Row and column counts, plus a downloadable .json result

How to convert CSV to JSON

  1. 1Drop the CSV file or paste its textDrag a .csv or .tsv onto the input pane. Files opened in Excel and saved as CSV-US-ASCII frequently carry Windows-1252 bytes; the panel warns when high-bit characters appear without a UTF-8 BOM.
  2. 2Confirm the delimiter and header settingsThe detected delimiter is printed with its evidence. Override it only when your file legitimately looks ambiguous, such as a single-column export.
  3. 3Choose how conservative typing should beSafe mode types only unambiguous integers, floats and booleans and leaves anything that could be an identifier alone. Aggressive mode also converts date-like and leading-zero strings, which is exactly where zip codes go wrong.
  4. 4Read the issues before downloadingRagged rows, duplicate headers, cells that overflow the safe integer range and formula-looking values are each listed with row and column so the fix is in the source, not in the JSON.

Type inference, mode by mode

What each inference setting does to the same set of cell values.
CellNoneSafeAggressive
42"42"4242
0042"0042""0042"42 — leading zeros lost
9007199254740993"9007199254740993""9007199254740993""9007199254740993" — guard holds
N"N""N""N"
2025-01-07"2025-01-07""2025-01-07""2025-01-07" — never a bare number
empty""nullnull

Aggressive mode is offered for machine-generated files with a known schema; for anything a human edited, Safe is the setting that keeps your identifiers intact.

Frequently asked questions

Can I just split the file on commas?

No. RFC 4180 §2 permits a quoted field to contain commas and line breaks, so both the line split and the field split can be wrong. The only correct approach is a character state machine that tracks whether it is inside quotes; see the CSV guide for the two-stage grammar.

Why did my zip code lose its leading zero?

Something between you and the JSON converted the column to a number — usually Excel on open, or an inferring parser. Keep type inference on Safe and the value arrives as a string; the issues list flags columns where leading zeros appear at all.

What delimiter does it detect automatically?

Comma, tab, semicolon or pipe, chosen by which one splits every sampled record into the same field count most consistently. The reason string tells you the winner and the runner-up, so a wrong guess is visible rather than silent.

How do I get an array of arrays instead of objects?

Set the output shape to array-of-arrays, which keeps column order and emits no keys — useful for database COPY and INSERT statements. Object-of-arrays is the column-oriented shape that analytics tools prefer.

Does it handle huge CSV files?

Up to what your tab can hold: several hundred megabytes on a typical laptop. Above that the browser is the wrong tool and you want a streaming reader — Go encoding/csv, Python csv with an iterator, DuckDB read_csv, or csvtk.

What is the spreadsheet damage audit?

A pass over the parsed model that reports cells a spreadsheet application is likely to reinterpret: long numerics, values that look like formulas, strings resembling dates, and gene-symbol-style tokens. Each row names the risk and the fix, and it is the same check the JSON to CSV direction applies on the way out.

Why does the converter explain its delimiter and typing decisions?

Because neither is something the file can confirm. Candidate delimiters are scored on header and row consistency and the winner is named with a field-count histogram, so a wrong sniff is visible instead of silent — RFC 4180 only says commas, tabs and semicolons are common, and Excel localises the separator to ";" where the decimal mark is a comma. Every coerced column is listed with the rule applied and how many values satisfied or failed it, and integer strings longer than 15 digits or carrying a leading zero stay strings unless you override that.