RevealTheme logo

CSV轉JSON工具

將CSV資料轉換為JSON物件陣列。第一行被視為表頭。

如何使用本工具

  1. 1

    Paste your CSV — make sure the first row holds the column headers.

  2. 2

    Click Convert. Each following row becomes a JSON object keyed by the header names.

  3. 3

    Copy the JSON array, ready to drop into a JavaScript file, API mock, or seed script.

什麼是CSV轉JSON工具?

CSV轉JSON是JSON轉CSV的逆過程。當你從試算表或資料庫的匯出中獲得資料,並需要在JavaScript應用中使用時,它會很有用。本工具遵循RFC 4180:帶引號的欄位會被去除引號,雙引號會被反跳脫,引號內的換行符會被保留。

常見使用場景

  • Turn a clean spreadsheet of products, users, or locations into a JSON array to seed a database or mock an API.

  • Convert exported analytics or CRM data into JSON for a quick chart or dashboard prototype.

  • Build test fixtures from a CSV someone handed you, without writing a parser.

  • Migrate config that lives in a spreadsheet into a JSON file your app reads at build time.

  • Sanity-check a CSV's structure — malformed rows become obvious when the object keys stop lining up.

  • Hand front-end developers ready-to-use JSON instead of a raw export they'd have to parse themselves.

常見問題

它使用什麼分隔符?
預設使用逗號。TSV(定位字元分隔)需要預處理。
資料類型是如何處理的?
所有值都是字串:JSON擁有帶類型的數字,但在沒有結構描述定義的情況下解析CSV是有歧義的。請在你的應用中轉換資料類型。

相關工具