induwara.lk
induwara.lkDeveloper · Utility

CSV to JSON Converter

Paste or upload a CSV/TSV file and get clean JSON instantly. Handles quoted fields, custom delimiters, type inference, and nested keys — all in your browser, with nothing uploaded. Copy or download in one click.

By Induwara AshinsanaUpdated Jun 26, 2026
CSV / TSV to JSON
Runs in your browser
Delimiter
Output shape

92 characters, 4 lines.

Verified — re-parses as valid JSON with 3 records · comma delimiter (auto).

Records
3
Top-level JSON entries
Columns
4
Detected fields per row
Delimiter
Comma
Auto-detected
Output size
273 B
92 B in

Sources: parsing per RFC 4180, output per RFC 8259. Everything stays on your device.

How it works

This converter is a deterministic format transformation: it reads CSV text shaped by RFC 4180 and emits JSON shaped by RFC 8259. There is no external API and no server round-trip — the entire pipeline runs in your browser, so spreadsheet exports, payroll files, and client lists never leave your device.

  1. Decode & clean. The input is read as UTF-8, a leading byte-order mark (BOM) is stripped per the WHATWG Encoding Standard, and line endings (\r\n or \r) are normalised to \n.
  2. Detect the delimiter. On Auto, the first non-empty line is sampled and the unquoted occurrences of comma, semicolon, tab, and pipe are counted; the highest wins. Any manual choice always overrides detection.
  3. Tokenize per RFC 4180 §2. A single-pass state machine reads fields that may be wrapped in double quotes; inside a quoted field a literal quote is written as "", and quoted fields may contain the delimiter and line breaks. That is why "Owes Rs 1,200" stays one field. Unquoted fields are optionally trimmed of surrounding spaces.
  4. Build keys. With a header row, the first record supplies the object keys; blank keys become column_N and duplicates are suffixed _2, _3, each with a note. Rows shorter than the header are padded with null; longer rows overflow into extra columns. Adjustments are warnings, never errors.
  5. Infer types (optional). Per cell, in order: empty → null; a numeric literal within the IEEE-754 safe-integer range → number; case-insensitive true/false → boolean; otherwise the string is kept. To protect identifiers, a value with a leading zero (a phone number such as 0712345678) and an integer past 253−1 are deliberately kept as strings so no precision is lost. Inference is per-cell, so one stray value never re-types the column.
  6. Nest by dot-notation. Header keys containing a dot — address.city — build nested objects, and numeric segments build arrays.
  7. Serialize per RFC 8259 §7–9. Output is produced with the native JSON.stringify, which already escapes strings and emits valid number, boolean, and null literals.

Every successful run is cross-checked: the emitted text is parsed back with the browser's standards-compliant JSON.parse and the record count must match what was read from the CSV. The summary line under the output reports the verified record count and the delimiter that was used.

Worked examples

Typed array of objects (header on, infer on)

CSV input

name,age,active,note
Nimal,32,true,"Owes Rs 1,200"
Kamala,,false,

JSON output

[
  { "name": "Nimal", "age": 32, "active": true, "note": "Owes Rs 1,200" },
  { "name": "Kamala", "age": null, "active": false, "note": null }
]
  • The quoted "Owes Rs 1,200" keeps its embedded comma as one field.
  • 32 → number, true/false → boolean, empty age and trailing note → null.

Leading-zero phone numbers, inference on

CSV input

id,phone
7,0712345678

JSON output

[
  { "id": 7, "phone": "0712345678" }
]
  • 7 has no leading zero, so it becomes the number 7.
  • 0712345678 starts with a zero before more digits — kept as a string so the phone number is not mangled into 712345678.

No header, semicolon delimiter, array of arrays, inference off

CSV input

0712345678;0771112223
0759998887;0112556677

JSON output

[
  ["0712345678", "0771112223"],
  ["0759998887", "0112556677"]
]
  • With inference off every cell stays a string, preserving leading zeros.
  • No header means each row becomes a positional JSON array.

Frequently asked questions

Sources & references

The parsing and serialization rules on this page were last cross-checked against RFC 4180 and RFC 8259 on 2026-06-26. The page is reviewed whenever a relevant standard or edge-case bug report comes in.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a CSV edge case that does not parse right, or want a new option?

Email me at [email protected] — most fixes ship within 24 hours.