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 → TOON Runtime
⚡

TOON Runtime

Native JavaScript access with schema-aware serialization.

Tagged template
import { toon } from "toonkit2";

const employees = toon`
employees[2]{id:n,name:s,salary:n,active:b}:
1,Riya,90000,true
2,John,80000,false
`;

employees[0].salary = 95000;
employees.push({ id: 3, name: "Manoj", salary: 100000, active: true });
console.log(employees.toToon());

The returned value is a real array or object, so property access, push/pop/splice, map/filter/find/reduce, destructuring, and JSON.stringify work normally. Mutations are reflected in toToon(). Parsed values also expose toJSON()to return a plain JavaScript clone; row counts and schemas are recalculated automatically.

Helpers
toon.toToon(employees);
toon.toJSON(employees);
toon.clone(employees);
toon.equals(a, b);