文件格式任意转换助手Transfer Any File

离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser

JSON 转 HTML 查看器——离线、可折叠、不上传JSON to HTML viewer offline, collapsible, no upload

一坨压成一行的 JSON 用编辑器看很累,而在线格式化器要把数据交出去。这条路把 JSON 解析后渲染成一棵折叠树:键、字符串、数字、布尔与 `null` 各有独立样式,每个对象与数组都是一个默认展开的 `<details>`,摘要写着 `Object(4)`、`Array(3)`,空对象与空数组直接收成 `{}`、`[]`。所有名字与值都经过转义后作为**文字**写出,所以产物里没有能被浏览器执行的标记,也没有任何指向网络的引用——文件本身也只带一份内联样式表。渲染器是显式栈的迭代实现,这一点是刻意的:递归版本在解析成功之后仍会在很深的结构上把栈耗尽,把一次正常转换报成 `RangeError`。A JSON blob squeezed onto one line is painful in an editor, and an online formatter asks you to hand over the data first. This route parses the file and renders a collapsible tree: keys, strings, numbers, booleans and `null` each get their own style, every object and array is a `<details>` expanded by default whose summary reads `Object(4)` or `Array(3)`, and empty ones collapse to `{}` and `[]`. Names and values are escaped and written as **text**, so the artefact contains no markup the browser can execute and no reference to the network — the file carries one inline stylesheet and nothing else. The renderer is an explicit-stack loop rather than recursion, deliberately so: the recursive version kept exhausting the stack on very deep documents after a successful parse, turning an ordinary conversion into a `RangeError`.

一批转换结果卡片,含文件名、体积与下载入口
一次混合批量,一个 ZIP 下载One mixed batch, one ZIP download

这条链路怎么走How the route runs

JSONJSON HTMLHTML

共 1 步,由扩展的路径搜索自动选出,中间产物不落盘。1 step, chosen by the extension's own path search; intermediate results never touch the disk.

会保留什么What carries over

  • 类型可分辨:键、字符串、数字、布尔与 `null` 各自着色,不必靠引号去猜 `30` 与 `"30"` 是不是同一个东西Types stay distinguishable: keys, strings, numbers, booleans and `null` are coloured separately, so nobody has to guess from quotes whether `30` and `"30"` are the same thing
  • 计数随行:折叠状态下也看得见 `Object(4)` / `Array(n)`,「这里有几项」不用展开就知道Counts travel with the node: `Object(4)` / `Array(n)` are visible even while collapsed, so “how many items here” needs no clicking
  • 值按文字写出:所有名字与标量都先转义,产物里没有可执行标记,也没有远程引用,双击打开不会替你请求任何东西Values are written as text: names and scalars are escaped first, so the artefact carries no executable markup and no remote reference — double-clicking it asks the network for nothing
  • 深结构不再炸栈:渲染走显式栈的迭代实现,几百层嵌套的文档也只会得到一份很长的页面,而不是 `RangeError`Deep structures no longer blow the stack: the renderer walks an explicit work list, so a document hundreds of levels deep yields a long page instead of a `RangeError`

如实说明的限制What it does not do

  • 默认全部展开:折叠能力在文件里(`<details>`),但初打开时树是全开的,超大文档会得到一屏接一屏的内容Everything starts expanded: the folding exists in the file as `<details>`, but the tree opens fully, so a huge document is a lot of scrolling
  • 产物是给人看的展示物,不是可再解析的数据源:里面没有原始字节顺序与缩进,也没有「哪层是数组哪层是对象」的可编程语义The artefact is for reading, not for parsing back: key order and indentation are not preserved as data, and there is no machine-readable meaning in which level was an array
  • 搜索与折叠操作只有浏览器自带的:产物没有本工作台预览面板里的搜索框、计数器与表格视图Searching and collapsing are the browser’s own: the file has none of the workbench preview’s search box, match counter or table projection
  • 不做的加工:不排序键、不去重、不展开 JSON 字符串里嵌套的 JSON、也不按字段做表格投影(那是预览里的表格视图)No processing is done: keys are not sorted, nothing is de-duplicated, JSON inside a string is not unpacked, and no per-field table projection happens (that is the preview’s table view)
  • 非法 JSON 直接报错而不是尽力修复;输入按严格解码链读取(UTF-16 嗅探 + UTF-8 → GB18030 → GBK),读不出文本时报错而非产出乱码Invalid JSON fails instead of being repaired; input goes through the strict decode chain (UTF-16 sniffing plus UTF-8 → GB18030 → GBK) and fails rather than producing mojibake

实操提示Working with it

  • 要能筛排的数据表:JSON 转 CSV(对象数组按键取并集,缺的键留空)或转 ExcelFor data you can filter and sort: JSON to CSV (an array of objects becomes columns from the union of keys, missing ones empty) or to Excel
  • 要一份可归档、可打印的快照:JSON 转 PDF(整页渲染成图片,没有文字层)或转 WordFor an archivable, printable snapshot: JSON to PDF — whole pages of bitmaps with no text layer — or to Word
  • 只想在浏览器里读着看却不需要文件:工作台预览自带搜索、可见行计数与数组表视图,比产物更适合翻阅To read it in the browser without needing a file: the workbench preview has search, a visible-row count and an array table view, which suits skimming better than the artefact does

常见问题Questions people actually ask

这个 HTML 里会不会藏着我数据里的脚本?Can a script inside my data survive into the HTML?

不会。键与值都是先转义再写出的文字,`<script>` 之类只会显示成字符;文件里也没有任何指向网络的引用。这也是本项目对「不可信输入」的统一做法:渲染边界先净化或转义。No. Names and values are escaped before they are written, so `<script>` shows up as characters, and the file references nothing on the network. That is the project’s standing rule for untrusted input: sanitise or escape at the rendering boundary first.

为什么打开后没有搜索框?Why is there no search box in the file?

产物是纯静态展示标记,搜索、匹配计数与数组表视图属于工作台的预览面板。要用浏览器的 Ctrl+F,或者回到工作台里预览。The artefact is static presentation markup; search, match counts and the array table view belong to the workbench preview. Use the browser’s Ctrl+F, or preview inside the workbench.

很大的 JSON(几十 MB)能转吗?Will a very large JSON file (tens of MB) convert?

能试,但有界:单个文件上限 100 MB、一批最多 200 个。深结构不会再炸栈,但产物会是非常长的一页——真要翻阅建议先在源头分段,或改用转 CSV / Excel。You can try: 100 MB per file and 200 files per batch. Deep structures no longer exhaust the stack, but the result is a very long page — for real skimming, split the source or take CSV / Excel instead.

数据会离开这台电脑吗?Does the data ever leave this machine?

不会。解析、着色、折叠标记全部在扩展自己的标签页里完成,只申请 storage 权限、没有 host 权限,全程零网络请求。No. Parsing, colouring and the folding markup all happen inside the extension’s own tab: the storage permission only, no host permissions, and no requests at any point.

不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.