TOON Formatter & Validator

Free Validate · Re-encode with chosen delimiter & indent · Syntax highlighted
Indent
Delimiter
TOON INPUT
OUTPUT
// TOON output
Lines: Est. tokens:

更多开发工具

TOON→JSON
转 JSON
JSON→TOON
LLM Token 格式
JSON 格式化
格式化、验证与压缩
Base64
编码/解码
URL 编码
百分比编码
正则表达式
实时测试
YAML 格式化
格式化与验证
JSON→YAML
转 YAML 配置

About TOON Formatter & Validator

Validate & Re-encode TOON

Parses your TOON via a full round-trip through the data model, then re-serialises it cleanly. Catches structural errors, malformed tabular arrays, and invalid scalar values.

Delimiter & Indent Control

Choose comma or pipe as the tabular delimiter and set 2 or 4-space indentation for nested objects. Useful for re-encoding TOON to match a specific LLM prompt style or downstream parser.

Tabular Array Optimisation

Uniform arrays of objects are automatically collapsed into the compact tabular header-plus-rows format, maximising token savings when sending data to an LLM.

隐私优先

All formatting runs in your browser — no data is sent to any server. Safe for TOON payloads containing business data, PII, or proprietary schemas.

常见问题

What is TOON?

TOON (Token-Oriented Object Notation) is a compact, lossless encoding of the JSON data model designed to reduce token count when sending structured data to large language models. It uses YAML-style indentation for objects and a CSV-style tabular layout for uniform arrays, achieving up to 60% fewer tokens than equivalent JSON.

Why format TOON before sending to an LLM?

Consistent formatting helps LLMs parse structure reliably. The formatter ensures tabular arrays are properly collapsed, indentation is uniform, and all scalar values are correctly quoted — reducing the chance of the model misreading the structure.

What is the tabular array format?

When all objects in an array share the same primitive-valued fields, TOON writes a header key[N]{f1,f2,f3}: followed by one comma-separated data row per object. This is the biggest source of token savings compared to JSON.

Is formatting TOON lossless?

Yes. The formatter works by parsing TOON into the full JSON data model and then re-encoding it. All values, types, and structure are preserved. The only changes are whitespace normalisation and delimiter/indent adjustments you explicitly choose.

深度指南
JSON 完整指南
格式化、验证、转换与最佳实践
阅读指南