JSON to CSV
Convert an array of JSON objects into CSV
JSON to CSV — what it does
Convert an array of JSON objects into CSV, with the object keys becoming the header row and each object a data row. It is the bridge between systems that speak JSON and the spreadsheets, finance tools and importers that only speak tables.
Worked example
Three order objects with uneven keys — one carries a note, another a paid flag — converted and then downloaded as converted.csv.
Input — JSON array
[
{"order_id": 1001, "customer": "Ann Lee", "product": "Notebook, A5", "qty": 12, "total": 42.0},
{"order_id": 1002, "customer": "Ben Ortiz", "product": "Stapler", "qty": 3, "total": 26.97, "note": "Rush order"},
{"order_id": 1003, "customer": "Chloe Park", "product": "Desk lamp", "qty": 1, "total": null, "paid": true}
]Output — CSV
order_id,customer,product,qty,total,note,paid 1001,Ann Lee,"Notebook, A5",12,42,, 1002,Ben Ortiz,Stapler,3,26.97,Rush order, 1003,Chloe Park,Desk lamp,1,,,true
Columns are the union of all keys in first-seen order; a missing key (note for order 1003) and a null total both become empty cells, 42.0 is written as 42, and the product containing a comma is quoted.
When this tool helps
- Getting an API export into a spreadsheet for analysis or a colleague's review.
- Preparing JSON data for a system that only accepts CSV uploads.
- Producing a human-readable table from a payload for a report.
How to use it
- Provide the JSON array of objects.
- Process the conversion.
- Review the resulting table.
- Download the CSV file.
Accuracy, limits, and good practice
- Objects with differing keys produce a union of columns, so records missing a field simply have an empty cell there.
- Nested objects have no natural column; flatten the JSON first so each nested value gets its own dotted column name.
- Values containing commas, quotes or line breaks are quoted in the output, keeping the file parseable everywhere.
- Check the column list before importing anywhere: a payload where one record carries an extra field silently adds a column the destination may not expect.
Frequently asked questions
What if my JSON is a single object, not an array?
Wrap it in an array, or extract the array you want with the JSON path extractor first.
How are nested arrays handled?
They have no tabular equivalent. Flatten the document first, which turns array elements into indexed columns.
Can I get an Excel file directly?
Yes, the JSON to Excel tool writes an XLSX workbook, with optional flattening of nested objects.
What happens to boolean and null values?
They become their text representations, so a receiving system needs to interpret true, false and empty strings itself.
What is the download called, and why does the button sometimes do nothing?
The file is always converted.csv. The Download button is only wired up after a successful Convert, so before the first conversion, or after one that ended in an error, clicking it does nothing.
What happens to nested objects and to numbers?
A nested object is written as the text [object Object] — flatten the JSON first if you need its values. Numbers are re-serialised, so 42.0 becomes 42 and 2.10 becomes 2.1; large integers beyond 16 digits lose precision.
Related tools on this site
- CSV Delimiter Converter — Convert comma, semicolon, tab, or pipe-delimited data
- CSV Row Splitter — Split a CSV into smaller files by row count
- JSON Array Filter — Filter JSON array items by a nested field and condition
Further reading: Cleaning a CSV export before you import it anywhere · CSV, JSON, YAML, XML and Markdown Tables: When Each Fits and How to Convert
Everything above runs inside this page. JSON to CSV needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
JSON 轉 CSV能做什麼
把 JSON 物件陣列轉成 CSV,物件的鍵成為標題列,每個物件成為一列資料。它是「說 JSON 的系統」與「只認表格的試算表、財務工具與匯入程式」之間的橋樑。
實際範例
三筆鍵不一致的訂單物件(一筆多了 note、另一筆多了 paid)轉換後,再下載為 converted.csv。
輸入:JSON 陣列
[
{"order_id": 1001, "customer": "Ann Lee", "product": "Notebook, A5", "qty": 12, "total": 42.0},
{"order_id": 1002, "customer": "Ben Ortiz", "product": "Stapler", "qty": 3, "total": 26.97, "note": "Rush order"},
{"order_id": 1003, "customer": "Chloe Park", "product": "Desk lamp", "qty": 1, "total": null, "paid": true}
]輸出:CSV
order_id,customer,product,qty,total,note,paid 1001,Ann Lee,"Notebook, A5",12,42,, 1002,Ben Ortiz,Stapler,3,26.97,Rush order, 1003,Chloe Park,Desk lamp,1,,,true
欄位是所有鍵的聯集,依首次出現的順序排列;缺少的鍵(訂單 1003 的 note)與 null 的 total 都變成空儲存格,42.0 寫成 42,含逗號的 product 會加上引號。
什麼時候用得上
- 把 API 匯出資料放進試算表,供分析或同事審閱。
- 為只接受 CSV 上傳的系統準備 JSON 資料。
- 把載荷整理成人看得懂的表格放進報告。
使用步驟
- 提供 JSON 物件陣列。
- 執行轉換。
- 檢視產生的表格。
- 下載 CSV 檔案。
精確度、限制與實務建議
- 鍵不一致的物件會產生欄位聯集,缺少該欄位的紀錄在該格留空即可。
- 巢狀物件沒有天然對應的欄位;請先攤平 JSON,讓每個巢狀值有自己的點路徑欄名。
- 含逗號、引號或換行的值在輸出中會加引號,確保檔案到哪都解析得了。
- 匯入任何地方前請先檢查欄位清單:只要有一筆紀錄多了一個欄位,就會悄悄多出一欄,而目的端未必預期得到。
常見問題
如果我的 JSON 是單一物件而不是陣列?
請把它包成陣列,或先用 JSON 路徑提取工具取出需要的陣列。
巢狀陣列怎麼處理?
它沒有表格上的對應。請先攤平文件,陣列元素會變成帶索引的欄位。
可以直接得到 Excel 檔嗎?
可以,JSON 轉 Excel 工具會寫出 XLSX 活頁簿,並可選擇攤平巢狀物件。
布林值與 null 會怎樣?
會變成對應的文字形式,因此接收系統必須自行解讀 true、false 與空字串。
下載的檔案叫什麼?按鈕為何有時沒反應?
檔名固定是 converted.csv。下載按鈕要在成功轉換一次之後才會接上功能,所以第一次轉換前、或上一次轉換出錯後,按了不會有任何動作。
巢狀物件和數字會怎麼處理?
巢狀物件會寫成文字 [object Object],需要其中的值請先把 JSON 攤平。數字會重新序列化:42.0 變成 42、2.10 變成 2.1;超過 16 位的整數會失去精度。
本站相關工具
- CSV 分隔符轉換 — 轉換逗號、分號、Tab 或直線分隔資料
- CSV 按行數拆分 — 依指定行數將 CSV 拆分成多個檔案
- JSON 陣列篩選器 — 依巢狀欄位與條件篩選 JSON 陣列資料
延伸閱讀: 匯入之前先把 CSV 匯出檔清乾淨 · CSV、JSON、YAML、XML 與 Markdown 表格:各自適用的場合與轉換方法
以上步驟全部在這個頁面內完成,JSON 轉 CSV 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。