离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser
JSON 转 CSV——对象数组离线落成表格JSON to CSV — an array of objects becomes a table
接口给了一个数组,你要的是能发给同事的一张表。规则很简单:取数组里所有对象的键并集当表头,缺失的键留空,嵌套的对象与数组按 JSON 文本写进单元格。所以它不做的是「替你把结构拍平」——那一步需要知道你的数据语义,机器不该猜。整个转换在标签页里完成,数据不出本机。An API handed you an array and what you need is a table a colleague can open. The rule is simple: headers are the union of every key across the objects, absent keys come out empty, and a nested object or array is written into its cell as JSON text. What this deliberately does not do is flatten your structure for you — that step needs to know what your data means, and a machine should not guess. All of it happens in the tab, and the data never leaves your machine.
这条链路怎么走How the route runs
JSONJSON CSVCSV
共 1 步,由扩展的路径搜索自动选出,中间产物不落盘。1 step, chosen by the extension's own path search; intermediate results never touch the disk.
会保留什么What carries over
- 表头为所有对象键的并集,顺序按首次出现,缺失键留空而不是错位Headers are the union of all keys, ordered by first appearance; a missing key becomes an empty cell rather than a shifted row
- null 与缺字段都写为空单元格,数字与布尔按原值写null and absent fields both write empty; numbers and booleans write their value
- 嵌套对象与数组以 JSON 文本入格,信息不丢,便于下一步用 jq 或 Excel 公式处理Nested objects and arrays land in the cell as JSON text, so nothing is lost and a next step in jq or a spreadsheet formula can use them
- 标量或嵌套数组没有键可挂时写进一列 `_value`;若记录本身已用该键,合成列自动改名,绝不丢行A scalar or nested array with no keys lands in a single `_value` column; if a record already uses that key the synthetic column is renamed, so no row is dropped
- 字符串以 = + - @ 开头时转义,防止一个 JSON 字段在 Excel 里被当成公式执行A string beginning with = + - @ is escaped, so one JSON field cannot execute as a formula in Excel
如实说明的限制What it does not do
- 输入必须是包含数据的数组。单独一个对象、空数组或一组空对象会报错(errors.jsonNotArray),而不是给你一个看起来成功的空文件The input must be an array containing data. A bare object, an empty array, or an array of empty objects reports an error (errors.jsonNotArray) instead of producing a file that looks like success and is empty
- 不做扁平化:a.b.c 不会被拆成三列,需要拆就先用 jq 或「转成 Excel」之前的加工做一次No flattening: a.b.c is not split into three columns. Flatten first with jq if the result has to be a flat grid
- 不读取网络上的 JSON:文件必须是本地的那一份It never reads JSON from the network — it has to be the local copy
实操提示Working with it
- CSV 开头带 UTF-8 BOM,Excel 双击打开中文不乱码The CSV heads with a UTF-8 BOM so Excel opens Chinese correctly on a double click
- 同一份 JSON 也可以直接转成 .xlsx 或 HTML 表格预览;批量最多 200 个文件The same JSON can go straight to .xlsx or to an HTML table for preview; up to 200 files per batch
常见问题Questions people actually ask
为什么提示我 JSON 格式不对?Why is it telling me the JSON is wrong?
最常见的是根节点不是数组。表格是二维结构,数组里的每个元素才是一行;对象没有「行」的天然含义,所以宁可报错也不替你猜。The usual cause is a root that is not an array. A table is two-dimensional and each element of the array is one row; a bare object has no natural notion of a row, so the app reports an error rather than guessing.
嵌套字段能变成列吗?Can nested fields become columns?
不会自动。可以先用 jq 拍平(例如 [.[] | {id, name: .user.name}])再转,或直接转成 .xlsx 后在 Excel 里加工。Not automatically. Flatten first with jq (say [.[] | {id, name: .user.name}]) and then convert, or convert to .xlsx and reshape it in Excel.
大文件会不会把浏览器卡住?Will a big file lock up the browser?
解析在主线程完成,单个文件上限 100 MB;解析失败会给出该文件的错误提示,批次里其余文件继续。Parsing happens on the main thread with a 100 MB ceiling per file; a file that fails reports its own error while the rest of the batch continues.
不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.
从 Chrome 应用商店安装Install from the Chrome Web Store 安装步骤Install steps GitHub 源码Source on GitHub