🚀 Introducing zio-toon: When Functional Programming Meets Token Efficiency
I've been working on something exciting for the Scala community: zio-toon, a library that brings TOON (Token-Oriented Object Notation) to the ZIO ecosystem.
Why does this matter? In our LLM-driven world, tokens are the new currency. Every character counts when you're working within context windows or optimizing API costs. zio-toon delivers 30-60% token reduction compared to JSON while maintaining all the type safety and composability we love about ZIO.
The killer feature? Tabular arrays. Instead of repeating field names for every object, TOON uses a header-based format:
...
users[5]{id,name,role,department}:
1,Alice Johnson,Engineering Manager,Backend
2,Bob Smith,Senior Developer,Frontend
...
But it's not just about efficiency. zio-toon demonstrates ZIO's elegant patterns:
- Effect-oriented programming for pure, composable operations
- Service pattern with clean dependency injection
- Type-safe error handling without exceptions
- Streaming support for memory-efficient processing
I've included comprehensive benchmarks, 93+ unit tests, and real-world examples showing everything from API responses to large-scale log processing.
This project represents where I think serialization is heading: functional, efficient, and built for the AI era. Whether you're building LLM integrations, high-performance APIs, or data pipelines, the principles here matter.
The Scala ecosystem continues to push boundaries in practical ways. zio-toon is my contribution to that tradition.
Read the full introduction: https://riccardomerolla.github.io/2025/11/12/introducing-zio-toon-token-efficient-serialization.html
GitHub: https://github.com/riccardomerolla/zio-toon
Built with ❤️ for the community. Questions and feedback welcome!
#scala #zio #serialization #llm #functionalprogramming
users[5]{id,name,role,department}:
1,Alice Johnson,Engineering Manager,Backend
2,Bob Smith,Senior Developer,Frontend
...
But it's not just about efficiency. zio-toon demonstrates ZIO's elegant patterns:
- Effect-oriented programming for pure, composable operations
- Service pattern with clean dependency injection
- Type-safe error handling without exceptions
- Streaming support for memory-efficient processing
I've included comprehensive benchmarks, 93+ unit tests, and real-world examples showing everything from API responses to large-scale log processing.
This project represents where I think serialization is heading: functional, efficient, and built for the AI era. Whether you're building LLM integrations, high-performance APIs, or data pipelines, the principles here matter.
The Scala ecosystem continues to push boundaries in practical ways. zio-toon is my contribution to that tradition.
Read the full introduction: https://riccardomerolla.github.io/2025/11/12/introducing-zio-toon-token-efficient-serialization.html
GitHub: https://github.com/riccardomerolla/zio-toon
Built with ❤️ for the community. Questions and feedback welcome!
#scala #zio #serialization #llm #functionalprogramming