⇢

CSV to JSON

Convert CSV rows into JSON objects

[]

CSV to JSON — what it does

Turn a CSV file into a JSON array of objects, using the header row as the property names for every record. It is the format shift you need whenever tabular data has to reach an API, a JavaScript application or a configuration file that has no concept of rows and columns.

When this tool helps

  • Preparing seed or fixture data for an application from a spreadsheet a colleague maintains.
  • Building a request body for an API that accepts a bulk array of records.
  • Moving a lookup table into a static site or front-end bundle as a JSON asset.

How to use it

  1. Choose the CSV file.
  2. Let the tool parse the header and rows.
  3. Review the JSON in the output panel.
  4. Copy or save the JSON for your project.

Accuracy, limits, and good practice

  • Every value comes through as a string, because CSV carries no type information. Cast numbers and booleans on the receiving side if it matters.
  • Header names become object keys verbatim, so headers with spaces or punctuation produce keys that need bracket notation in code.
  • Empty cells become empty strings rather than null; treat that distinction deliberately if your schema separates blank from missing.

Frequently asked questions

Can I get nested JSON?

Not directly. Convert to a flat array first, then reshape it — the JSON flattener and path extractor help with the reverse direction.

What if my CSV has no header row?

Add one first. Without headers there are no key names, and the first data row would be consumed as labels.

Is the output valid JSON?

Yes. Quotes, backslashes and line breaks inside values are escaped so the result parses in any JSON reader.

Related tools on this site

Everything above runs inside this page. CSV to JSON needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

CSV 轉 JSON能做什麼

把 CSV 檔案轉成 JSON 物件陣列,並以標題列作為每筆紀錄的屬性名稱。當表格資料必須送進 API、JavaScript 應用程式,或送進沒有「列與欄」概念的設定檔時,這就是必要的格式轉換。

什麼時候用得上

  • 從同事維護的試算表,產生應用程式的種子或測試資料。
  • 為接受批次陣列的 API 準備請求內容。
  • 把對照表以 JSON 資產的形式放進靜態網站或前端打包檔。

使用步驟

  1. 選擇 CSV 檔案。
  2. 由工具解析標題與資料列。
  3. 在輸出區檢視 JSON。
  4. 複製或儲存 JSON 供專案使用。

精確度、限制與實務建議

  • 所有值都會以字串輸出,因為 CSV 本身不帶型別資訊;若型別重要,請在接收端自行轉型。
  • 標題會原樣成為物件鍵名,含空格或標點的標題在程式中需用中括號語法存取。
  • 空白儲存格會變成空字串而非 null;若你的結構要區分「空白」與「缺漏」,請特別留意。

常見問題

可以產生巢狀 JSON 嗎?

無法直接產生。請先轉成平面陣列再自行重組;反方向可用 JSON 扁平化與路徑提取工具處理。

CSV 沒有標題列怎麼辦?

請先補上標題。沒有標題就沒有鍵名,第一列資料會被當成標籤吃掉。

輸出是合法 JSON 嗎?

是。值中的引號、反斜線與換行都會逸出,任何 JSON 解析器都能讀取。

本站相關工具

以上步驟全部在這個頁面內完成,CSV 轉 JSON 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。