免费 · 开发
JSON 转 TOON 转换器.
在 JSON 与 TOON(Token-Oriented Object Notation)之间转换,减少发送给大模型的数据量,并显示大小对比和往返校验。
Loading the calculator…
把 JSON 转成 TOON 以节省 token
- 粘贴 JSON,或粘贴 TOON 以解码回 JSON。
- 选择表格行内使用的分隔符。
- 复制结果。大小对比会显示节省了多少,往返校验确认没有任何内容丢失。
TOON(Token-Oriented Object Notation,面向 token 的对象表示法)是一种紧凑的文本格式,用于向大语言模型发送结构化数据。示例:包含 id、name、role、active 字段的三个用户,会变成一个表头 users[3]{id,name,role,active}: 加三行简短数据,比压缩后的 JSON 小约 40%。
格式原理
- 对象用缩进代替花括号,数组标注其长度,写作 [N]。
- 由字段相同的扁平对象组成的数组会变成表格:字段名只在 {字段} 表头中出现一次,之后每项一行。
- 字符串只在必要时加引号,从而去掉 JSON 中大量重复的标点。
- token 数为估算值,约 4 个字符计 1 个 token;实际数量取决于模型的分词器。一切都在您的浏览器中完成。如需先整理 JSON,请使用 JSON 格式化;如需转成表格,可试试 JSON 转 CSV。
限制与支持格式
输入内容在您的设备上处理。
英语技术说明
Token counts are estimates (about 4 characters per token). Everything is calculated in your browser; nothing you type is uploaded.
Objects use indentation, arrays carry their length [N], and arrays of uniform flat objects become tables with a {field} header. Strings are quoted only when needed. Tested on thousands of random documents.
Three users with id, name, role and active become one header users[3]{id,name,role,active}: and three short rows — about 40 % smaller than compact JSON.
常见问题
TOON 是无损的吗?
对 JSON 数据是无损的。往返校验会把 TOON 解码回去,并与原始 JSON 比较。
什么情况下 TOON 最省?
当数据是字段相同的长对象数组时,例如用户、商品列表或日志行。
我的数据会被发送给 AI 服务吗?
不会。转换在您的浏览器中完成,结果粘贴到哪里由您决定。