{"id":50316489,"url":"https://github.com/codebydusk/hypertoon","last_synced_at":"2026-05-29T00:03:31.633Z","repository":{"id":333752794,"uuid":"1138559211","full_name":"codebydusk/hypertoon","owner":"codebydusk","description":"HyperToon is a high-performance, type-safe converter for TOON (Token-Oriented Object Notation). It is designed for high-throughput applications where speed and bundle size are critical.","archived":false,"fork":false,"pushed_at":"2026-02-15T20:03:00.000Z","size":75,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T10:32:19.341Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hypertoon","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codebydusk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-20T20:38:59.000Z","updated_at":"2026-02-15T20:03:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codebydusk/hypertoon","commit_stats":null,"previous_names":["dusk196/hypertoon","codebydusk/hypertoon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codebydusk/hypertoon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebydusk%2Fhypertoon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebydusk%2Fhypertoon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebydusk%2Fhypertoon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebydusk%2Fhypertoon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebydusk","download_url":"https://codeload.github.com/codebydusk/hypertoon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebydusk%2Fhypertoon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33631002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-29T00:03:28.807Z","updated_at":"2026-05-29T00:03:31.623Z","avatar_url":"https://github.com/codebydusk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HyperToon 🚀\n\n[![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=for-the-badge\u0026logo=bun\u0026logoColor=white)](https://bun.sh)\n[![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-red.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)\n\n**HyperToon** is a high-performance, type-safe converter for **TOON** (Token-Oriented Object Notation). It is designed for high-throughput applications where **speed** and **bundle size** are critical.\n\n## 🏆 Competitive Benchmarks\n\nWe compared `hypertoon` against the Official `@toon-format/toon` and the leading competitor `json-toon` (10,000 records).\n\n| Metric | HyperToon | `json-toon` | `@toon-format/toon` |\n|--------|-----------|--------------------------|---------------------------|\n| **Bundle Size (Minified)** | 4.9 KB | **🚀 4.5 KB** | 64.4 KB |\n| **Bundle Size (Gzipped)** | 1.9 KB | **🚀 1.7 KB** | 13.2 KB |\n| **Serialize Speed**| **⚡ 121 ops/s** | 87 ops/s | 16 ops/s |\n| **Parse Speed** | **⚡ 83 ops/s** | 39 ops/s | 9 ops/s |\n| **Payload (Standard)** | 1.03 MB | **0.69 MB** | 1.63 MB |\n| **Payload (Flat)** | 274 KB | **254 KB** | 274 KB |\n\n\u003e **Verdict**: HyperToon is **~39% faster at serialization** and **~2.1x faster at parsing** than the nearest competitor, while being **~13x smaller** than the official library. It trades a tiny size margin against `json-toon` for dramatically superior throughput.\n\n## Features\n\n- ⚡ **Hyper Optimized**: `charCodeAt`-based cursor parser avoids memory spikes and string allocations.\n- 🦕 **Bun Native**: Built with Bun for speed and modern standards.\n- 🔒 **Type-Safe**: `jsonify\u003cT\u003e()` provides full TypeScript support.\n- ✨ **Official Syntax**: Fully compliant with TOON `key: value` specification.\n- 🛡️ **Robust**: Handles complex nested JSON objects, unicode, and emojis.\n- 📦 **Zero Runtime Dependencies**: Lightweight and dependency-free.\n- 🔢 **Type Preservation**: Correctly handles numeric strings vs numbers (e.g., `\"1.0\"` vs `1`).\n\n## Installation\n\n```bash\nbun add hypertoon\n# or\nnpm install hypertoon\n```\n\n## Usage\n\n### 1. Serialize (`toonify`)\n\nConvert complex JSON data to TOON format.\n\n```ts\nimport { toonify } from 'hypertoon';\n\nconst data = {\n  project: \"Titanium\",\n  active: true,\n  metadata: {\n    version: \"1.0\", // Preserved as string\n    tags: [\"fast\", \"secure\", \"scalable\"]\n  },\n  users: [\n    { id: 1, name: \"Alice\", role: \"Admin\", verified: true },\n    { id: 2, name: \"Bob\", role: \"User\", verified: false }\n  ]\n};\n\nconst toon = toonify(data);\nconsole.log(toon);\n/* Output:\nproject: Titanium\nactive: true\nmetadata:\n    version: \"1.0\"\n    tags[3]:\n        - fast\n        - secure\n        - scalable\nusers[2]{id,name,role,verified}:\n    1,Alice,Admin,true\n    2,Bob,User,false\n*/\n```\n\n### 2. Parse (`jsonify`)\n\nParse TOON string back to JSON with full type safety.\n\n```ts\nimport { jsonify } from 'hypertoon';\n\ninterface Config {\n  server: {\n    host: string;\n    port: number;\n  };\n  endpoints: string[];\n}\n\nconst toon = `\nserver:\n    host: localhost\n    port: 8080\nendpoints[2]:\n    - /api/v1\n    - /health\n`;\n\nconst config = jsonify\u003cConfig\u003e(toon);\nconsole.log(config.server.port); // 8080\n```\n\n## API Reference\n\n### `toonify(data: unknown): string`\n\n- **data**: The input JSON object or value to serialize.\n- **Returns**: A TOON-formatted string.\n- **Notes**: Automatically detects tabular data structures for compression.\n\n### `jsonify\u003cT = unknown\u003e(toon: string): T`\n\n- **toon**: The input TOON string to parse.\n- **Returns**: The parsed object cast to type `T`.\n- **Notes**: Supports standard TOON syntax, including tabular arrays and lists.\n\n## Why Use Hypertoon?\n\nWhen dealing with **large datasets** in web applications, traditional JSON can become a bottleneck. Hypertoon solves this with TOON format—a human-readable, bandwidth-efficient alternative.\n\n### Key Benefits\n\n- **🚀 Faster Serialization**: Hypertoon is ~39% faster than competitors and ~7x faster than the official library\n- **⚡ 2x Faster Parsing**: Over 2x the throughput of the nearest competitor at parsing TOON data\n- **📉 Bandwidth Savings**: Up to 60% smaller payloads for tabular data without gzip overhead\n- **⚡ Performance at Scale**: Cursor-based parser prevents garbage collection pauses with millions of records\n- **🔒 Type Safety**: Full TypeScript support with `jsonify\u003cT\u003e()` eliminates runtime surprises\n- **🔄 Zero Lock-in**: 100% compatible with the TOON specification\n\n### Real-World Example: API with Large Data\n\nImagine serving 10,000 user records from your API. Here's how Hypertoon reduces bandwidth and improves performance:\n\n#### Backend (Bun/Node.js)\n\n```ts\nimport { toonify } from 'hypertoon';\n\n// Fetch 10,000 user records from database\napp.get('/api/users', async (req, res) =\u003e {\n  const users = await db.query('SELECT id, name, email, role FROM users LIMIT 10000');\n  \n  // Serialize to TOON (293 KB vs 1,524 KB for JSON)\n  const toonData = toonify(users);\n  \n  res.setHeader('Content-Type', 'application/toon');\n  res.send(toonData);\n});\n```\n\n#### Frontend (Browser)\n\n```ts\nimport { jsonify } from 'hypertoon';\n\ninterface User {\n  id: number;\n  name: string;\n  email: string;\n  role: string;\n}\n\n// Fetch and parse TOON data\nconst response = await fetch('/api/users');\nconst toonData = await response.text();\n\n// Parse TOON to typed object (saves ~700 KB bandwidth)\nconst users = jsonify\u003cUser[]\u003e(toonData);\n\nconsole.log(users[0].name); // Type-safe access\n```\n\n**Result**: 54% smaller payload (293 KB vs 704 KB for `json-toon`, 1,075 KB for `@toon-format/toon`) with faster parsing and full type safety.\n\n## Contributing\n\nContributions are welcome!\n\n1.  Clone the repository.\n2.  Install dependencies: `bun install`\n3.  Run tests: `bun test`\n4.  Run benchmarks: `bun run benchmark`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebydusk%2Fhypertoon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebydusk%2Fhypertoon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebydusk%2Fhypertoon/lists"}