npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yson-format

v0.1.0

Published

Hyper-compact LLM-native data format that saves 35-60% tokens compared to JSON

Readme

YSON: Hyper-Compact Data Format for LLMs

Save 35-60% on LLM API costs by using fewer tokens for the same data.

YSON (Why-son) is a data serialization format designed for AI applications. It reduces token usage while maintaining full compatibility with JSON, making your LLM applications faster and cheaper.

Why YSON?

Massive Cost Savings

Every token costs money. YSON uses 35-60% fewer tokens than JSON.

Real-world impact:

  • 10,000 API calls/day with JSON: ~$15/day
  • Same calls with YSON: ~$6-9/day
  • Annual savings: $2,000-3,000+

The Difference

JSON (45 tokens):

{
  "users": [
    {"id": 1, "name": "Alice", "age": 30},
    {"id": 2, "name": "Bob", "age": 25},
    {"id": 3, "name": "Carol", "age": 35}
  ]
}

YSON (18 tokens - 60% reduction):

users
  $S id name age
    1 Alice 30
    2 Bob 25
    3 Carol 35

Key Features

  • Schema-Based Compression: Define structure once, reuse for all rows
  • Space-Delimited: No unnecessary punctuation
  • Smart Quoting: Quotes only when needed
  • Human-Readable: Easy to read, write, and debug
  • 100% JSON Compatible: Perfect round-trip conversion

Quick Start

# Clone and install
git clone https://github.com/YuvrajGupta1808/yson.git
cd yson
npm install

# Run demo
npm run demo

Basic Usage

import { YSONConverter } from './src/index.js';

// JSON to YSON
const data = { user: { id: 1, name: "Alice" } };
const yson = YSONConverter.encode(data);
console.log(yson);
// Output:
// user
//   id 1 name Alice

// YSON to JSON
const json = YSONConverter.decode(yson);

// Count tokens
const tokens = YSONConverter.countTokens(yson);

Live Examples with Gemini API

# Get API key from https://aistudio.google.com/app/apikey
# Add to .env: GEMINI_API_KEY=your-key

npm run gemini:compare     # Compare formats
npm run gemini:retrieval   # Test accuracy
npm run gemini:optimize    # See optimization
npm run gemini:format      # Input/output efficiency
npm run gemini:company     # Data analysis

When to Use YSON

Perfect For:

  • High-volume LLM API calls
  • RAG systems with large context
  • AI agent communication
  • Cost-sensitive applications
  • Structured data in prompts

Proven Results

Token Reduction vs JSON:

  • Simple objects: 40-60% fewer tokens
  • Arrays with schemas: 50-70% fewer tokens
  • Nested structures: 30-40% fewer tokens

Tested with Google Gemini API on real-world data with identical accuracy.

Works With

  • OpenAI (GPT-4, GPT-3.5)
  • Google Gemini
  • Anthropic Claude
  • Open-source models (Llama, Mistral, etc.)
  • Any LLM that accepts text input

API Reference

// YSONConverter
YSONConverter.encode(jsonObject)      // JSON to YSON
YSONConverter.decode(ysonString)      // YSON to JSON
YSONConverter.countTokens(ysonString) // Count tokens

// JSONParser
JSONParser.parse(jsonString)
JSONParser.stringify(ast, pretty=false)
JSONParser.countTokens(jsonString)

License

MIT


Start saving on your LLM costs today.