
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@temporal-cortex/toon
Advanced tools
TOON (Token-Oriented Object Notation) encoder/decoder — compact JSON for LLMs
WASM-powered TOON (Token-Oriented Object Notation) encoder/decoder for Node.js.
This package wraps the Rust temporal-cortex-toon library via WebAssembly, providing near-native performance for TOON encoding and decoding in JavaScript/TypeScript environments.
npm install @temporal-cortex/toon
# or
pnpm add @temporal-cortex/toon
import { encode, decode } from "@temporal-cortex/toon";
// JSON string → TOON string
const toon = encode('{"name":"Alice","scores":[95,87,92]}');
console.log(toon);
// name: Alice
// scores[3]: 95,87,92
// TOON string → JSON string (perfect roundtrip)
const json = decode(toon);
console.log(json);
// {"name":"Alice","scores":[95,87,92]}
encode(json: string): stringConverts a valid JSON string into TOON format. Throws if the input is not valid JSON.
decode(toon: string): stringConverts a TOON string back into compact JSON. Throws if the input is not valid TOON.
This package requires the WASM artifacts to be built from the Rust crate first:
# From the monorepo root:
# 1. Build the WASM binary
cargo build -p temporal-cortex-toon-wasm --target wasm32-unknown-unknown --release
# 2. Generate Node.js bindings
wasm-bindgen --target nodejs \
--out-dir packages/temporal-cortex-toon-js/wasm/ \
target/wasm32-unknown-unknown/release/toon_wasm.wasm
# 3. Rename for ESM/CJS compatibility
mv packages/temporal-cortex-toon-js/wasm/toon_wasm.js packages/temporal-cortex-toon-js/wasm/toon_wasm.cjs
# 4. Build TypeScript
pnpm --filter @temporal-cortex/toon build
# 5. Run tests
pnpm --filter @temporal-cortex/toon test
src/index.ts ← Public API (encode/decode), loads WASM via createRequire
wasm/toon_wasm.cjs ← wasm-bindgen generated CommonJS bindings
wasm/toon_wasm.wasm ← Compiled WASM binary from temporal-cortex-toon (Rust)
wasm/toon_wasm.d.ts ← TypeScript type declarations for WASM exports
The package uses createRequire(import.meta.url) to load the CommonJS WASM bindings from an ESM context. This bridges the module system mismatch since wasm-bindgen --target nodejs generates CommonJS but the package uses "type": "module".
26 tests covering encode, decode, and roundtrip operations:
pnpm --filter @temporal-cortex/toon test
MIT OR Apache-2.0
FAQs
TOON (Token-Oriented Object Notation) encoder/decoder — compact JSON for LLMs
We found that @temporal-cortex/toon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.