toonkit2
Type-SafeCompactHuman-ReadableMIT

toonkit2

A parser & serializer for TOON — Typed Object Oriented Notation. Transform JSON to compact TOON format and back with built-in type awareness.

$ npm install toonkit2
Docs → Performance
⚡

Performance & Size

Why TOON is more efficient than JSON

JSON repeats every key name in every object. TOON declares the schema once, then uses compact row values. For tabular data with many rows, this saves significant bytes and parsing time.

Size Comparison

Same Data — JSON vs TOON
// JSON: ~145 bytes
{"devices":[{"device_id":"DEVICE_PRO_01","battery":87,"is_active":true},{"device_id":"DEVICE_PRO_02","battery":92,"is_active":false}]}

// TOON: ~90 bytes (38% reduction)
devices[2]{device_id:s,battery:n,is_active:b}:
DEVICE_PRO_01,87,true
DEVICE_PRO_02,92,false
JSON
  • ❌ Keys repeated per row
  • ❌ Nested braces & quotes
  • ❌ Heavier for tables
  • ❌ More to parse
TOON
  • ✅ Keys declared once
  • ✅ CSV-style rows
  • ✅ Compact payloads
  • ✅ Faster to parse
Ready to use toonkit2?

Install the recommended toonkit2 package from npm or JSR, import the functions, and start converting between JSON and TOON. Perfect for REST APIs, bots, IoT devices, and any system where payload size matters.