Online CSV/JSON Converter: Convert Between Table Data Formats
What Are CSV and JSON
CSV (Comma-Separated Values) is tabular text: a header row, then one record per row, fields separated by commas by default.
JSON expresses objects and arrays for APIs and programs. ToolVault's CSV/JSON Converter converts both ways in the browser — nothing is uploaded.
Comparison example (matches this site's output)
CSV:
name,email,age
Alice,alice@example.com,28
Bob,bob@example.com,32
JSON (all strings — this tool does not infer types):
[
{ "name": "Alice", "email": "alice@example.com", "age": "28" },
{ "name": "Bob", "email": "bob@example.com", "age": "32" }
]
Note age stays "28", not the number 28. Coerce per column downstream when you need numeric types.
CSV vs JSON
| Feature | CSV | JSON |
|---|---|---|
| Readability | Tabular | Structured |
| Nesting | Flatten or lose it | Native |
| Types | Text only | String, number, boolean, null, … |
| Typical use | Spreadsheets, bulk tables | APIs, nested payloads |
| Excel | Opens directly (watch encoding/delimiter) | Needs a table first |
How to use this converter (real UI)
Open the CSV/JSON Converter:
- Paste CSV (with a header) or a JSON array of objects on the left.
- Click CSV → JSON or JSON → CSV — the tool does not auto-detect direction and does not sniff delimiters.
- Choose a delimiter: comma
,, semicolon;, or Tab (shared for parse and emit). - Copy or download the result.
Implementer's notes (csvToJson / jsonToCsv)
Delimiter
- UI offers
,/;/ Tab; the second argument tocsvToJson/jsonToCsvmatches the control. - Locale Excel exports that use
;can be pasted directly with the semicolon option—no need to pre-normalize via CSV/TSV.
Quoting (RFC 4180 subset)
- Fields with commas, quotes, or newlines must be wrapped in
"...". - Escape quotes by doubling:
"said ""hi"""→said "hi". - A
"mid-field (not starting the field) →CSV_QUOTE_POSITION_ERROR. - Unclosed quotes →
CSV_QUOTE_NOT_CLOSED. - Newlines inside quotes are legal (one logical record can span physical lines).
Headers
- Row 0 is the header; keys are trimmed.
- Header-only input →
[]. - Blank input →
[].
Empty cells and column counts
- Empty cells become
"", never JSONnull. - Every data row must match the header width or you get
CSV_FIELD_COUNT_MISMATCH. - Fully blank rows are skipped.
Newlines and BOM
\nand\r\nare accepted (\ralone is skipped).- The whole input is
trim()'d; JS trim strips a leading UTF-8 BOM (U+FEFF), so Excel "CSV UTF-8" headers usually do not becomeBOM+name. - If another toolchain keeps the BOM on the first header, that path did not strip it — this one does.
JSON → CSV extras
- Input must be an array of objects.
- Headers are the union of keys (first-seen order); missing keys become empty cells.
null/undefined→ empty cell.- Values starting with
=,+,-,@, etc. get a leading tab to reduce Excel/WPS formula injection risk. - Fields with
,,", or newlines are RFC-quoted.
Large-file boundary
- The full string is held in memory; fine for interactive and mid-size tables.
- Hundreds of thousands of rows or ~100MB+ blobs belong in streaming CLIs or database loaders — not a tab.
RFC 4180, Excel dialects, and the real cracks
RFC 4180 describes a common shape (comma + quotes + CRLF) but is not globally enforced:
- Delimiter follows locale — German Excel often emits
;; this tool stays on,. - Quoting is "when needed" — exporters that skip quotes corrupt the first important address field.
- Record ≠ physical line — quoted newlines break naive
split('\n')scripts. - BOM — decides whether the first header join fails silently.
Treat CSV as a dialected text table, not "JSON with commas".
Round-trips are not identity
Even staying on this site:
- Types stay strings end-to-end (predictable — no silent
00123→123). - Column order after JSON→CSV follows key-union scan order, which may differ from the original CSV.
- CSV has no
null; the return trip will not invent one. - Nested objects are not flattened here. For dotted keys and custom delimiters, use JSON → CSV.
Cluster links: JSON, SQL, YAML
| Next step | Tool |
|---|---|
| Flatten nested JSON | JSON → CSV |
| Semicolon / TSV | CSV/TSV |
| Dev-db INSERT demos | CSV → SQL |
| Pretty-print SQL | SQL formatter |
| Config shape | YAML ↔ JSON |
| Structure checks | JSON Schema |
Related posts: JSON/CSV guide, CSV to SQL, YAML/JSON.
Failure cheat sheet
| Symptom | Likely cause | Fix |
|---|---|---|
CSV_FIELD_COUNT_MISMATCH | Extra/missing commas or unquoted commas | Quote the field or normalize via TSV |
CSV_QUOTE_NOT_CLOSED | Odd unpaired " | Close or remove the quote |
| Mojibake | GBK/other bytes pasted as UTF-8 | Re-encode to UTF-8 |
| One giant column | Semicolon file | CSV/TSV converter first |
| Excel formula surprise | Cell starts with = | JSON→CSV here prefixes a tab; hand-authored CSV needs care |
FAQ
Commas inside fields?
Wrap in quotes: "Shanghai, Pudong". Or switch to TSV via CSV/TSV.
Why are numbers still strings?
CSV→JSON here deliberately skips type inference so order IDs and leading zeros survive. Coerce in the app or with SQL CAST.
Difference from the JSON→CSV tool?
- CSV/JSON: both directions, fixed comma, string values, strict column counts.
- JSON→CSV: JSON-first export, optional flatten, custom delimiter, header toggle.
Large files?
Interactive sizes yes; 100MB+ use a local pipeline. Browser memory roughly doubles (source string + object graph).
From ToolVault. Related: CSV/JSON, JSON→CSV, CSV→SQL, YAML↔JSON. More on the homepage.
Related Tools
Related Articles
Online CSV to SQL Tool: Import Tabular Data into Databases
CSV to INSERT with empty cells → NULL, MySQL backticks or PostgreSQL quotes, BOM stripping, Markdown pipe escaping, and when to switch to COPY/LOAD instead.
HTML Table to JSON: How to Preserve Rows, Columns and Structure
Converting an HTML table from a web page to JSON — how to keep headers, handle merged cells and nested structure? Step-by-step with our HTML table to JSON tool.
Excel to JSON: Dates Become Numbers / Chinese Garbled — Fix
When converting Excel to JSON, dates turn into numbers like 44927, Chinese is garbled, empty cells vanish? Explains Excel serial dates and encoding pitfalls, with our Excel to JSON tool.