Switch tool

CSV ⇄ JSON

Convert between CSV and JSON in both directions with custom delimiters and header detection.

CSV input
JSON output

How to use

Purpose

CSV and JSON bidirectional converter handling header rows, quote escaping, fields with commas, fields with newlines, empty values, encodings (UTF-8 / GBK), separators (comma/tab/semicolon/pipe). Supports CSV-to-JSON array, JSON array-to-CSV table, flattening nested objects. Common for Excel data into databases, API data exports to Excel, data migration, bulk form filling. All conversion runs locally — sensitive business data does not leave the browser.

Steps

  1. Paste CSV or JSON array on the left
  2. Tool auto-detects format
  3. CSV → JSON: first row is keys, each row is an object, output is an array
  4. JSON → CSV: first row keys (merged across all objects), values per row
  5. Separator: comma (default), tab, semicolon, pipe, custom
  6. Encoding: UTF-8 (default), GBK (legacy Excel files)
  7. Nested object: flatten to a.b.c dot path or a_b_c underscore
  8. Export: .csv or .json

FAQ

CSV fields with commas?
Per RFC 4180, wrap in double quotes: `"hello, world",foo,bar`. Double quotes inside use two double quotes: `"he said ""hi"""`. Tool handles this. Note: Chinese Excel often exports CSV in GBK — switch charset.
How to flatten JSON nested objects to CSV?
`{"user":{"name":"Tom","age":30}}` flattens to `user.name=Tom, user.age=30` (two columns). Modes: dot path (default), underscore (user_name, user_age), JSON string (one column with the nested object as a JSON string).
What if CSV first row is not a header?
Disable "detect header" — tool uses col_0, col_1, col_2 as keys. Or manually specify a header (comma-separated names in the input box).
Excel opens UTF-8 CSV showing garbled Chinese?
Excel for Windows defaults to GBK and needs a BOM to read UTF-8. Check "include UTF-8 BOM" on export, or export as GBK directly. Newer macOS Excel supports UTF-8 natively.
How are empty fields / null represented?
CSV: consecutive separators (a,,b) for empty. JSON: explicit null. Default conversion: CSV empty → JSON null (clearer); JSON null → CSV empty. Toggle to CSV empty → JSON empty string "" to preserve value type.

Use cases

  • Excel data into database: CSV → JSON → bulk insert API
  • API data into Excel: JSON data converted to CSV for business teams
  • Data migration: legacy DB export CSV → JSON → import to new DB
  • Bulk form filling: form JSON data converted to CSV for Excel template
  • Data analysis: JSON API data to CSV for Excel / pandas

Use cases

Excel ↔ database/API, data migration, bulk form filling, analysis prep. Backend, data engineering, ops, finance. RFC 4180 standard, nested flattening, Excel BOM, multi-charset are the differentiators.