Show HN: CTON: JSON-compatible, token-efficient text format for LLM prompts
3 days ago
- #Ruby
- #data-serialization
- #LLM-optimization
- CTON (Compact Token-Oriented Notation) is a minified, JSON-compatible wire format optimized for LLMs.
- CTON removes unnecessary JSON syntax (indentation, excessive quoting, braces) while adding structural hints.
- Key features include implicit root, minimal punctuation, and table compression for arrays of objects.
- CTON provides significant token savings (50–60% compared to raw JSON).
- Installation is via Ruby gem (`bundle add cton` or `gem install cton`).
- Usage includes encoding/decoding between Ruby hashes and CTON strings, with options for pretty printing and streaming.
- Performance benchmarks show CTON's efficiency in encoding/decoding.
- CTON includes a CLI tool for JSON-CTON conversions.
- Teaching CTON to LLMs involves explaining its syntax and structure.
- Development includes RBS signatures for type checking and IDE support.
- Contributions are welcome, following the project's Code of Conduct.
- CTON is licensed under MIT.