TOON Converter
oiu85/toon-converter-windows-applicarion
Converter JSON/texto para TOON, economizando tokens em LLMs com 100% fidelidade
Ver no GitHubAplicativo Windows desktop profissional que converte JSON/texto para formato TOON, otimizando o uso de tokens em LLMs em 15-30% sem perda de dados. Usa análise inteligente de padrões e cache para reduzir chamadas à API em até 80% para dados estruturados.
Instalação
npx convez-ai oiu85/toon-converter-windows-applicarion1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Reduzir custos de APIs de LLM através de compressão de tokens
- Otimizar payloads para processamento de dados estruturados em modelos de IA
- Converter entre formatos JSON e TOON mantendo reversibilidade completa
Veredito

Ferramenta especializada e bem construída em Dart/Flutter para quem trabalha com LLMs e precisa otimizar custos de tokens. A versão 2.0 com parsing inteligente de padrões agrega valor real, embora o nicho seja específico para desenvolvedores de aplicações com IA.
README
A tradução para o português deste README ainda está na fila.
TOON Converter
Professional Windows Desktop Application for Converting JSON/Text to TOON Format
Optimize your LLM token usage by up to 30% while maintaining 100% data fidelity
🚀 Version 2.0 Now Available! - Smart conversion with 60-80% reduction in LLM API calls for structured data.
Features • What's New in v2.0 • Installation • Usage • Documentation • Contributing
📋 Table of Contents
- Overview
- What's New in v2.0
- Version Comparison
- Features
- What is TOON?
- Screenshots
- Installation
- Usage
- TOON Format Specification
- Examples
- Architecture
- Development
- Building the Installer
- Troubleshooting
- Performance
- Contributing
- License
- Acknowledgments
🎯 Overview
TOON Converter is a professional, lightweight, and fast Windows desktop application designed to help developers optimize token usage when working with Large Language Models (LLMs). It converts any text or JSON input to a compact TOON (Token-Oriented Object Notation) format that reduces token count by 15-30% while maintaining 100% data fidelity and reversibility.
Why TOON Converter?
- 💰 Cost Savings: Reduce API costs by minimizing token usage
- ⚡ Performance: Faster processing with smaller payloads
- 🔒 Data Integrity: 100% accurate conversion with no data loss
- 🔄 Reversible: Convert back to JSON anytime
- 🎨 Professional UI: Modern, clean interface with Dark/Light mode
- 🚀 Easy to Use: Drag & drop, paste, or load files
- 🧠 Smart Conversion (v2.0): Intelligent pattern matching reduces LLM dependency by 60-80%
🆕 What's New in v2.0
Smart Conversion Optimization
Version 2.0 introduces a revolutionary Smart Conversion System that dramatically reduces dependency on Ollama LLM for structured data while maintaining 100% accuracy.
Key Improvements
-
Pattern Parser - No LLM Required
- Automatically detects and parses structured data (key-value pairs, lists, tables)
- Direct conversion to JSON without using Ollama
- 3-5x faster for structured data
- 100% free - no API calls needed
-
Smart Converter Engine
- Intelligent decision-making: Pattern parsing first, LLM fallback only when needed
- Automatic detection of structured vs. narrative text
- Seamless integration with existing Ollama workflow
-
Conversion Cache System
- In-memory caching with TTL (Time To Live)
- LRU (Least Recently Used) eviction policy
- Instant response for repeated conversions
- Reduces redundant processing
-
Enhanced Pattern Matching
- Supports key-value pairs with spaces:
Full Name: John Doe - Numbered lists:
1. Item,2. Item - Bulleted lists:
- Item,* Item - Tables: Pipe-separated
| col1 | col2 |or tab-separated - Automatic type inference (number, boolean, string)
- Supports key-value pairs with spaces:
Performance Metrics
- ✅ 60-80% reduction in Ollama API calls for structured data
- ⚡ 3-5x speed improvement for structured data conversions
- 💰 60-80% cost reduction for structured data processing
- 🎯 Same or better quality - maintains 100% accuracy
How It Works
Input Text
↓
Is it structured? (key-value, lists, tables)
├─ YES → Pattern Parser → JSON → TOON (no LLM, instant, free)
└─ NO → Ollama → JSON → TOON (smart, accurate, when needed)
📊 Version Comparison
v1.0 (Legacy)
| Feature | Description |
|---|---|
| Conversion Method | Always uses Ollama LLM for text-to-JSON conversion |
| Performance | Consistent but slower for structured data |
| Cost | Higher - every conversion requires LLM API call |
| Speed | ~2-5 seconds per conversion (depends on LLM response time) |
| Use Case | Best for narrative/complex text that needs LLM understanding |
v2.0 (Current)
| Feature | Description |
|---|---|
| Conversion Method | Smart hybrid: Pattern parsing first, LLM fallback |
| Performance | 3-5x faster for structured data, same speed for complex text |
| Cost | 60-80% lower - most structured data doesn't need LLM |
| Speed | <100ms for structured data, ~2-5s for complex text |
| Use Case | Optimal for both structured and narrative text |
| Cache | Built-in caching system for repeated conversions |
| Pattern Support | Key-value, lists, tables, mixed structures |
Migration from v1.0
- ✅ 100% Backward Compatible - All v1.0 features still work
- ✅ No Breaking Changes - Existing workflows continue to function
- ✅ Automatic Optimization - Smart converter activates automatically
- ✅ Optional Configuration - Can disable pattern parsing if needed
When to Use Each Approach
Use Pattern Parser (Automatic in v2.0):
- Key-value pairs:
Name: John, Age: 30 - Lists:
1. Item 1\n2. Item 2or- Item 1\n- Item 2 - Tables:
| Col1 | Col2 | - Structured data with clear patterns
Use Ollama (Automatic fallback in v2.0):
- Narrative text requiring understanding
- Complex unstructured content
- Natural language descriptions
- Mixed content with unclear structure
✨ Features
Core Features
-
✅ 100% Accurate Conversion
- Preserves all data, relationships, order, and logical structure
- No data loss or corruption
- Fully reversible to JSON
-
✅ Multiple Input Types
- Plain text
- JSON (nested, arrays, objects)
- Any text content from any source
-
✅ Token Optimization
- 15-30% average token reduction
- Real-time token count display
- Before/after comparison
-
✅ Professional UI
- Modern, clean design
- Dark/Light mode support
- Responsive layout
- Intuitive user experience
-
✅ File Operations
- Drag & drop support
- Load from file
- Save as .toon file
- Copy to clipboard
-
✅ Error Handling
- Comprehensive error messages
- Graceful failure handling
- User-friendly notifications
Advanced Features
- 📊 Real-time Statistics: View token counts and reduction percentage
- 🎨 Theme Support: Switch between Dark and Light modes
- 📁 File Association: Associate .toon files with the application
- 🔄 Auto-detection: Automatically detects JSON vs plain text
- ⚡ High Performance: Handles large files efficiently
- 🛡️ Robust: Never crashes, handles edge cases gracefully
v2.0 Exclusive Features
- 🧠 Smart Pattern Parser: Automatic structured data detection and parsing
- ⚡ Conversion Cache: Instant results for repeated conversions
- 🎯 Intelligent Routing: Automatic decision between pattern parsing and LLM
- 📈 Performance Monitoring: Detailed logging and statistics
- 🔧 Ollama Integration: Local LLM support with model selection
- 🛠️ JSON Guard: Automatic JSON validation and repair
🤔 What is TOON?
TOON (Token-Oriented Object Notation) is a compact data format specifically designed to minimize token usage in LLM interactions while maintaining complete data fidelity.
Key Principles
- Minimize Tokens: Remove unnecessary whitespace and structural overhead
- Preserve Data: Maintain all values, relationships, order, and structure
- Reversibility: 100% reversible conversion to/from JSON
- Type Safety: Preserve all data types (string, number, boolean, null, object, array)
Example
JSON Input:
{
"name": "Ahmed",
"age": 30,
"city": "Cairo"
}
TOON Output:
{name:"Ahmed",age:30,city:"Cairo"}
Token Reduction: ~20% (removed whitespace and unnecessary quotes)
For complete specification, see TOON Format Specification.
📸 Screenshots
Main Interface
┌─────────────────────────────────────────────────────────┐
│ TOON Converter [🌙] [☀️] │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ │
│ │ Input │ │ TOON │ │
│ │ Panel │ │ Output │ │
│ │ │ │ │ │
│ │ { │ │ {name:"..." │ │
│ │ "name": │ → │ ,age:30} │ │
│ │ "Ahmed" │ │ │ │
│ │ } │ │ │ │
│ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────────────────────────────────┐ │
│ │ Input: 150 tokens │ Output: 120 tokens │ │
│ │ Reduction: 20% │ [Copy] [Save] │ │
│ └──────────────────────────────────────────┘ │
│ │
│ [Convert to TOON] [Clear] │
└─────────────────────────────────────────────────────────┘
💾 Installation
Download Pre-built Installer
- Download
TOONConverter-Setup.exefrom the Releases page - Run the installer
- Follow the installation wizard
- Launch TOON Converter from Start Menu or Desktop
Build from Source
Prerequisites
-
Flutter SDK 3.9.2 or higher
- Download from flutter.dev
- Add Flutter to your system PATH
-
Windows 10/11 with:
- Visual Studio 2022 (with C++ desktop development workload)
- Windows SDK
Build Steps
-
Clone the repository
git clone https://github.com/yourusername/toon_converter.git cd toon_converter -
Install dependencies
flutter pub get -
Build the application
flutter build windows --release -
Run the application
flutter run -d windowsOr navigate to
build\windows\x64\runner\Release\and runtoon_converter.exe
🚀 Usage
Basic Usage
-
Launch TOON Converter
-
Input your data:
- Paste JSON or text into the input panel
- Drag and drop a file
- Click "Load File" to browse
-
Convert:
- Click "Convert to TOON" button
- View the result in the output panel
-
Export:
- Click "Copy" to copy to clipboard
- Click "Save" to save as .toon file
Advanced Features
Drag & Drop
- Drag any text file or JSON file onto the input panel
- The content will be automatically loaded
File Operations
- Load File: Browse and load any text/JSON file
- Save as .toon: Save the TOON output as a .toon file
- Copy: Copy TOON output to clipboard instantly
Theme Switching
- Click the theme toggle button (🌙/☀️) in the app bar
- Switch between Dark and Light modes
Statistics
- View input token count
- View output token count
- See reduction percentage in real-time
v2.0 Smart Features
Automatic Pattern Detection:
- The app automatically detects structured data
- Pattern parsing happens instantly (no LLM needed)
- Check the terminal/logs to see which method was used
Ollama Integration:
- Select your local Ollama model from the dropdown
- Default model:
qwen2.5:7b - Status indicator shows connection and processing state
- JSON preview panel shows intermediate results
Cache Benefits:
- Repeated conversions are instant (from cache)
- Cache automatically expires after 1 hour
- LRU eviction when cache is full (max 100 entries)
📖 TOON Format Specification
Basic Syntax
Objects
JSON: {"key": "value", "key2": "value2"}
TOON: {key:"value",key2:"value2"}
Arrays
JSON: [1, 2, 3, "text"]
TOON: [1,2,3,"text"]
Strings
- Preserved with quotes
- Escape sequences maintained:
\n,\t,\",\\
Numbers, Booleans, Null
- Preserved exactly as in JSON
Key Rules
- Whitespace Removal: All unnecessary whitespace removed
- Key Optimization: Keys unquoted when possible
- Structure Preservation: All nesting and relationships maintained
- Order Preservation: Key order in objects preserved
- Type Preservation: All data types remain unchanged
For complete specification, see TOON Format Specification.
📝 Examples
Example 1: Simple JSON
Input:
{
"name": "Ahmed",
"age": 30,
"city": "Cairo"
}
TOON Output:
{name:"Ahmed",age:30,city:"Cairo"}
Token Reduction: ~20%
Example 2: Nested JSON
Input:
{
"user": {
"id": 1,
"profile": {
"name": "Ali",
"email": "ali@example.com"
}
},
"tags": ["developer", "flutter"]
}
TOON Output:
{user:{id:1,profile:{name:"Ali",email:"ali@example.com"}},tags:["developer","flutter"]}
Token Reduction: ~25%
Example 3: Plain Text
Input:
Hello World
This is a test
TOON Output:
{type:"text",content:"Hello World\nThis is a test"}
Example 4: Complex Nested Structure
Input:
{
"users": [
{"id": 1, "name": "User 1", "active": true},
{"id": 2, "name": "User 2", "active": false}
],
"metadata": {
"count": 2,
"timestamp": 1234567890
}
}
TOON Output:
{users:[{id:1,name:"User 1",active:true},{id:2,name:"User 2",active:false}],metadata:{count:2,timestamp:1234567890}}
Token Reduction: ~28%
🏗️ Architecture
Project Structure
toon_converter/
├── lib/
│ ├── main.dart # Entry point
│ ├── app/
│ │ ├── app.dart # Main app widget
│ │ └── theme/ # Theme configuration
│ │ ├── app_theme.dart
│ │ └── colors.dart
│ ├── ui/
│ │ ├── screens/
│ │ │ └── converter_screen.dart # Main screen
│ │ ├── widgets/
│ │ │ ├── input_panel.dart
│ │ │ ├── output_panel.dart
│ │ │ ├── stats_display.dart
│ │ │ ├── action_buttons.dart
│ │ │ ├── model_selector.dart # v2.0: Ollama model selection
│ │ │ ├── status_indicator.dart # v2.0: Status display
│ │ │ └── json_preview_panel.dart # v2.0: JSON preview
│ │ └── components/
│ │ └── drag_drop_zone.dart
│ ├── services/
│ │ ├── conversion_service.dart # Core conversion logic
│ │ ├── smart_converter.dart # v2.0: Smart conversion engine
│ │ ├── pattern_parser.dart # v2.0: Pattern-based parsing
│ │ ├── conversion_cache.dart # v2.0: Caching system
│ │ ├── ollama_service.dart # v2.0: Ollama integration
│ │ ├── json_guard.dart # v2.0: JSON validation/repair
│ │ ├── json_optimizer.dart # v2.0: JSON optimization
│ │ ├── context_detector.dart # v2.0: Content type detection
│ │ ├── prompt_templates.dart # v2.0: LLM prompt templates
│ │ ├── logger.dart # v2.0: Comprehensive logging
│ │ ├── file_service.dart # File operations
│ │ ├── token_counter.dart # Token counting
│ │ └── input_detector.dart # Input type detection
│ ├── models/
│ │ ├── conversion_result.dart # Result model
│ │ └── app_state.dart # App state
│ └── utils/
│ ├── json_parser.dart # JSON parsing
│ └── toon_formatter.dart # TOON formatting
├── test/
│ └── conversion_test.dart # Unit tests
├── installer/
│ ├── setup.nsi # NSIS installer script
│ ├── build_installer.bat # Build automation
│ └── LICENSE.txt
├── docs/
│ └── TOON_SPECIFICATION.md # TOON format spec
└── README.md
Architecture Layers (v2.0)
┌─────────────────────────────────────┐
│ UI Layer (Flutter) │
│ ┌──────────┐ ┌──────────┐ │
│ │ Input │ │ Output │ │
│ │ Panel │ │ Panel │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────────┘
│
┌─────────────▼───────────────────────┐
│ Smart Conversion Layer (v2.0) │
│ ┌──────────────────────────────┐ │
│ │ Smart Converter │ │
│ │ - Pattern Parser (First) │ │
│ │ - Ollama Fallback │ │
│ │ - Cache Management │ │
│ └──────────────────────────────┘ │
└─────────────────────────────────────┘
│
┌─────────────▼───────────────────────┐
│ Business Logic Layer │
│ ┌──────────────────────────────┐ │
│ │ Conversion Service │ │
│ │ - Input Detection │ │
│ │ - JSON Parser │ │
│ │ - TOON Converter │ │
│ │ - Token Counter │ │
│ └──────────────────────────────┘ │
│ ┌──────────────────────────────┐ │
│ │ Ollama Service (v2.0) │ │
│ │ - Local LLM Integration │ │
│ │ - Model Selection │ │
│ │ - JSON Guard │ │
│ └──────────────────────────────┘ │
│ ┌──────────────────────────────┐ │
│ │ File Service │ │
│ │ - Save/Load │ │
│ │ - Drag & Drop │ │
│ └──────────────────────────────┘ │
└─────────────────────────────────────┘
Design Patterns
- Separation of Concerns: Clear separation between UI, business logic, and data
- Service Layer: Reusable services for conversion, file operations, and token counting
- State Management: ChangeNotifier pattern for app state
- Error Handling: Comprehensive error handling at all layers
🛠️ Development
Setting Up Development Environment
-
Install Flutter
# Verify installation flutter doctor -
Clone and Setup
git clone https://github.com/yourusername/toon_converter.git cd toon_converter flutter pub get -
Run in Development Mode
flutter run -d windows
Running Tests
flutter test
Code Structure
- Services: Business logic and data processing
- Models: Data structures and state management
- UI: Widgets and screens
- Utils: Helper functions and utilities
Dependencies
Core:
file_picker: File operationspath_provider: File system pathsclipboard: Clipboard operations
v2.0 Additions:
http: Ollama API communicationcrypto: SHA-256 hashing for cache keys
📦 Building the Installer
Prerequisites
- NSIS (Nullsoft Scriptable Install System)
- Download from nsis.sourceforge.io
- Add to system PATH
Automated Build
installer\build_installer.bat
This script will:
- Clean previous builds
- Build Flutter app in release mode
- Compile NSIS installer
- Create
TOONConverter-Setup.exe
Manual Build
-
Build Flutter app
flutter build windows --release -
Compile NSIS installer
cd installer makensis setup.nsi
The installer will be created as installer\TOONConverter-Setup.exe
For detailed instructions, see installer/README.md.
🔧 Troubleshooting
Common Issues
"Build output not found"
- Solution: Ensure you've built the Flutter app first:
flutter build windows --release
"File is locked" error
- Solution: Close the application and any IDEs, then try again
"NSIS not found"
- Solution: Install NSIS and add it to your PATH
"Flutter build failed"
- Solution: Run
flutter doctorto check your setup - Ensure Windows desktop development is enabled
Application won't start
- Solution:
- Check Windows Defender isn't blocking it
- Run as administrator
- Ensure all dependencies are installed
Getting Help
- 📖 Check the Documentation
- 🐛 Report Issues
- 💬 Ask Questions
⚡ Performance
Benchmarks
v1.0 Performance
- Small files (< 1KB): ~2-5s (LLM processing time)
- Medium files (1-100KB): ~3-8s
- Large files (100KB-1MB): ~5-15s
- Very large files (> 1MB): ~10-30s
v2.0 Performance
- Structured data (< 1KB): < 100ms (pattern parser, no LLM)
- Structured data (1-100KB): < 500ms (pattern parser)
- Complex text (< 1KB): ~2-5s (Ollama fallback)
- Complex text (1-100KB): ~3-8s (Ollama fallback)
- Cache hits: < 10ms (instant from cache)
Token Reduction
- Average reduction: 15-30%
- Best case (heavily formatted JSON): Up to 35%
- Worst case (minimal JSON): ~10%
API Call Reduction (v2.0)
- Structured data: 60-80% reduction (uses pattern parser)
- Mixed content: 30-50% reduction (partial pattern matching)
- Complex text: 0% reduction (uses Ollama as before)
Memory Usage
- Idle: ~50MB
- Processing: ~100-200MB (depending on file size)
- Peak: < 500MB
- Cache: ~10-50MB (depending on cache size)
🤝 Contributing
We welcome contributions! Here's how you can help:
Ways to Contribute
- 🐛 Report Bugs: Open an issue with detailed information
- 💡 Suggest Features: Share your ideas
- 📝 Improve Documentation: Fix typos, add examples
- 🔧 Submit Pull Requests: Implement features or fix bugs
- ⭐ Star the Project: Show your support
Contribution Guidelines
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature - Make your changes
- Write/update tests
- Ensure all tests pass
flutter test - Commit your changes
git commit -m "Add amazing feature" - Push to your fork
git push origin feature/amazing-feature - Open a Pull Request
Code Style
- Follow Dart/Flutter style guidelines
- Write clear, commented code
- Add tests for new features
- Update documentation as needed
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 TOON Converter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
🙏 Acknowledgments
- Flutter Team: For the amazing framework
- NSIS Contributors: For the installer system
- Community: For feedback and contributions
📞 Contact & Support
- GitHub: github.com/yourusername/toon_converter
- Issues: Report a Bug
- Discussions: Ask Questions
🗺️ Roadmap
Planned Features
- Reverse Conversion: TOON → JSON converter
- API Mode: HTTP server for integration
- Batch Processing: Process multiple files at once
- Format Support: YAML, XML conversion
- Custom Tokenizer: Integration with tiktoken
- Statistics Export: Detailed conversion reports
- Plugin System: Extensible architecture
- Multi-language: Internationalization support
Future Enhancements
- Cloud sync
- Command-line interface
- VS Code extension
- Web version
Made with ❤️ for the LLM developer community
⭐ Star this repo if you find it useful! ⭐