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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bhuvanshah/cjson

v0.1.3

Published

Compact JSON - Token-efficient serialization for LLMs

Readme

Compact JSON (CJSON)

Compact JSON (CJSON) is a token-efficient, human-readable serialization format inspired by TOON and optimized for LLM interactions. This repository contains the production-ready parser, encoder, and tooling along with the reference documentation.

Features

  • 40–70% token reduction compared to JSON
  • Familiar key/value syntax with optional compact array headers
  • Inline, multi-line, and compact array formats
  • Built-in comment support (# comment)
  • Zero runtime dependencies, written in TypeScript
  • Encode/decode/parsing APIs with rich error reporting

Installation

npm install @bhuvanshah/cjson
# or
yarn add @bhuvanshah/cjson

Note
If you're working from this repository before it's published to npm, run npm install in the repo root and import from ./src in your local experiments instead of '@bhuvanshah/cjson'.

Quick Start

import { encode, decode } from '@bhuvanshah/cjson';

const data = {
  name: 'Alice',
  age: 30,
  tags: ['developer', 'designer'],
  projects: [
    { name: 'Atlas', status: 'active' },
    { name: 'Zephyr', status: 'paused' },
  ],
};

const cjson = encode(data);
// name: Alice
// age: 30
// tags: [developer, designer]
// projects[2]{name, status}:
//   name: Atlas, status: active
//   name: Zephyr, status: paused

const parsed = decode(cjson);
// => original JavaScript object

Parsing only

import { parse, astToValue } from '@bhuvanshah/cjson';

const ast = parse('user:\n  name: Mira\n  active: true');
const value = astToValue(ast); // { user: { name: 'Mira', active: true } }

See docs/API.md for the full API surface (encode/decode/parse/options/validator).

Syntax at a Glance

# Comments start with '#'
name: Alice
age: 30
tags: [js, ts, rust]

address:
  city: Seattle
  zip: 98101

users[2]{name, role}:
  name: Ada, role: admin
  name: Bob, role: user

More examples and formal rules are in docs/SPEC.md.

Documentation

Examples

Example scripts live in the examples/ directory:

  • examples/basic.ts – encode/decode round trip
  • examples/parser.ts – inspect AST output
  • examples/validator.ts – validate documents against a schema

Run them with tsx:

npx tsx examples/basic.ts

Development

npm install
npm run build        # compile TypeScript
npm test             # run unit & integration tests (Vitest)
npm run lint         # run ESLint on src
npm run benchmark    # measure encode/decode performance

CI is provided via GitHub Actions (.github/workflows/ci.yml) and runs lint + tests + build on pushes/PRs targeting main or phase-5.

Project Status

  • Current version: 0.1.2 (early release; API may evolve).
  • Parser, encoder, decoder, validator, and benchmarks are implemented and covered by tests.
  • Install from npm: npm install @bhuvanshah/cjson

License

MIT © 2025-present CJSON contributors.

Support / Issues

  • File bugs or questions here: https://github.com/Bhuvannnn/CJSON/issues
  • Install from npm: npm install @bhuvanshah/cjson

References