logoYuvraj Gupta
HomeAboutProjectsSkillsContact
Resume
logoYuvraj Gupta
Back to Projects

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.

TypeScriptnpm package: yson-formatYSONConverter.encode / decode / countTokensIndentation-based nesting, $S schema compression
View CodeLive Demo
YSON – Compact Data Format for LLMs Screenshot

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

Duration

11/2025

Role

Author & Maintainer

Team Size

Solo Project

Status

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

Format Overview
Format Overview
From the demo: the key advantages, the npm install, and a nested store record side by side in JSON and YSON.
Token Count, Side by Side
Token Count, Side by Side
The same three-row table: 45 tokens as JSON, 18 as YSON with a single schema line.

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!

Get In TouchView More Projects

Yuvraj Gupta

AI Engineer building multi-agent systems, production retrieval, and research that ships. San Francisco.

Quick Links

  • Home
  • About
  • Projects
  • Skills
  • Contact

Get In Touch

📍San Francisco, CA
📧yuvrajgupta1808@gmail.com

© 2026 Yuvraj Gupta. All rights reserved.