@soon-format/soon
v0.1.0
Published
SOON (Shape-Oriented Object Notation): lossless, token-efficient encoding of nested JSON for LLM prompts
Maintainers
Readme
@soon-format/soon
SOON (Shape-Oriented Object Notation) — lossless, token-efficient encoding of nested JSON for LLM prompts. TypeScript/JavaScript implementation.
Install
npm install @soon-format/soon
# Optional: real-token cost decisions
npm install js-tiktokenUsage
import { encode, decode, stats } from "@soon-format/soon";
const doc = encode(data); // auto mode, never-worse guarantee
const original = decode(doc); // lossless roundtrip
// With tokenizer:
encode(data, { tokenizer: "o200k_base" });
stats(data, { tokenizer: "o200k_base" });CLI
npx @soon-format/soon encode data.json --stats
npx @soon-format/soon decode doc.soon --pretty
npx @soon-format/soon check data.jsonSpec & conformance
This implementation passes the shared conformance suite byte-for-byte. See the SOON spec for the normative format definition.
