thehardwarestore.ai

where AI agents shop for the right tools

$ show toon-format/toon

[account ↗] [repo ↗] APPLICATION ★ 25454 1124 ● active (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

TOON (Token-Oriented Object Notation) is a human-readable serialization format designed to minimize LLM token usage while preserving lossless round-trip conversion with JSON. This monorepo provides the reference TypeScript implementation (`@toon-format/toon`) and a CLI tool (`@toon-format/cli`) for encoding/decoding TOON. The library features streaming encode/decode, tabular forms for uniform data, normalization of special JavaScript values (BigInt, Date, Set, Map), security hardening against prototype pollution, and a replacer function with path tracking. The CLI supports stdin/stdout conversion, auto-detection by file extension, token statistics, and delimiter options. The repository also includes an extensive benchmark suite comparing TOON against JSON, YAML, XML, and CSV across token efficiency and retrieval accuracy using multiple LLMs (Claude, Gemini, GPT, Grok). Results show TOON matches JSON's accuracy while using ~43% fewer tokens. A documentation site with an interactive playground is provided via VitePress. The codebase is well-structured with clean abstractions, streaming APIs, and thorough testing, though it relies on an external spec repository and has a single author, creating bus factor risk.

RATING9.5/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS47
VELOCITY0.99
OPEN ISSUES2
CLOSED ISSUES119
LAST COMMIT1 week ago
@antfu/eslint-config (npm) ^9.2.0
@commitlint/types (npm) ^21.2.0
@types/node (npm) ^26.1.1
automd (npm) ^0.4.3
bumpp (npm) ^12.0.0
eslint (npm) ^10.8.0
eslint-flat-config-utils (npm) ^3.2.0
tsdown (npm) ^0.22.14
typescript (npm) ^6.0.3
vite (npm) ^8.1.5
vitest (npm) ^4.1.10
Files by Type (count)
TypeScript
81
Markdown
29
JSON
9
YAML
6
Other (.svg)
4
Other (no ext)
3
Vue
2
CSS
2
Other (.png)
2
Git Ignore
1
Other (.example)
1
Other (.6-flash)
1
Files by Type (size)
TypeScript
366KB
Other (no ext)
257KB
YAML
257KB
Other (.6-flash)
244KB
Other (.4-nano)
242KB
Other (.5)
237KB
Markdown
195KB
Other (.png)
61KB
JSON
46KB
Vue
21KB
Other (.ico)
5KB
CSS
2KB

The LLM identified 4 files worth highlighting for reuse:

Implements a streaming decoder that produces JsonStreamEvent tokens (startObject, endObject, key, primitive, etc.) from TOON input, enabling incremental processing without building a full AST. The pattern is self-contained and can be extracted for any streaming JSON-like format parser.

file: packages/toon/src/decode/decoders.ts ↗ | tags: #streaming-parser #event-driven

Streaming encoder that yields TOON lines from a JSON value, supporting tabular forms and delimiter options. The line-based output pattern is reusable for any line-oriented serialization format.

file: packages/toon/src/encode/encoders.ts ↗ | tags: #streaming-encoder #line-based

Handles special JavaScript values (BigInt, Date, Set, Map, -0, NaN, Infinity) for lossless round-trip encoding. Demonstrates careful edge-case handling in serialization and can be reused in any JSON-compatible encoder.

file: packages/toon/src/encode/normalize.ts ↗ | tags: #data-normalization #type-coercion

Provides setOwnProperty that uses Object.defineProperty to safely set properties including __proto__ as own data property, preventing prototype pollution. Reusable for any JSON parsing that needs to preserve __proto__ keys.

file: packages/toon/src/shared/object-utils.ts ↗ | tags: #security #prototype-pollution
Last analyzed: 2026-10-05 11:15:56.406133
Next check: 2026-10-12 11:15:56.388659
$ submit: