← 返回
未分类 中文

Shrink JSON in Prompts (TOON Encoder/Decoder)

Compress, encode, and decode large JSON payloads into a compact, reversible TOON string to reduce token usage in LLM prompts and tool payloads. Use when you...
Compress, encode, and decode large JSON payloads into a compact, reversible TOON string to reduce token usage in LLM prompts and tool payloads. Use when you...
zmkkevin
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 281
下载
💾 0
安装
1
版本
#latest

概述

toon-json (TOON v1)

Use the bundled script scripts/toon_json.py to encode JSON into a compact TOON string and decode it back losslessly.

Commands

Encode JSON -> TOON

  • Minimal:
python3 scripts/toon_json.py encode < input.json
  • With schema (better compression for repeated keys):
python3 scripts/toon_json.py encode --schema < input.json
  • Pretty wrapper (includes schema metadata):
python3 scripts/toon_json.py encode --schema --pretty < input.json

Decode TOON -> JSON

python3 scripts/toon_json.py decode < input.toon

Derive a schema (key dictionary) from JSON

python3 scripts/toon_json.py schema < input.json

Operational guidance

  • Prefer --schema when:
  • The JSON has many repeated keys (APIs, config blobs, tool outputs)
  • You will send similar objects repeatedly across turns
  • Prefer schema-less mode when:
  • One-shot payloads
  • You want maximum human readability

Safety / correctness

  • The format is designed to be lossless for JSON types: object, array, string, number, boolean, null.
  • Rejects non-JSON numbers (NaN/Inf) and non-string object keys.
  • If decoding fails, re-run with --pretty output on encode to inspect the embedded schema.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 15:51 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,363 📥 319,106
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,219 📥 266,924
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,569