YSON – Compact Data Format for LLMs
YSON is a data serialization format designed for AI applications. It drops the braces, brackets, colons, commas, and repeated keys that JSON spends tokens on, using indentation for nesting and a one-line schema for arrays of objects, while staying fully reversible back to JSON. On typical structured payloads it uses 35–60% fewer tokens, which means cheaper prompts, more room in the context window, and faster throughput for agents that pass data around. Published on npm as yson-format with a TypeScript encoder, decoder, and token counter.

Project Features
Space-Delimited Key-Values
No colons, commas, or brackets. Keys and values alternate on a line, and strings are quoted only when they contain spaces.
Schema Rows for Arrays
A $S line declares the columns once, then each row lists only values. This is where most of the savings on tabular data come from.
100% JSON Compatible
Encode any JSON to YSON and decode it back byte-for-byte. Existing pipelines keep JSON at the edges and use YSON inside the prompt.
Measured Savings
The README example drops a 45-token JSON payload to 18 tokens. Across a day of API calls that is real money, and across a context window it is real room.
Project Info
11/2025
Author & Maintainer
Solo Project
Published on npm
Technologies Used
- • TypeScript
- • npm package: yson-format
- • YSONConverter.encode / decode / countTokens
- • Indentation-based nesting, $S schema compression
- • Gemini API usage examples
Watch It Run
YSON: The Cleaner, Faster, Smarter Alternative to JSON
Walkthrough of the format, the schema rows, the round-trip guarantee, and the token counts side by side.
Project Gallery


Interested in This Project?
I'm always excited to discuss my projects and share insights about the development process. Feel free to reach out if you'd like to know more!