Metadata-Version: 2.4
Name: totoon
Version: 0.1.0
Summary: Convert any data format to TOON (Token-Oriented Object Notation)
Author-email: totoon <contact@totoon.dev>
License-Expression: MIT
Project-URL: Homepage, https://github.com/bug4fix/totoon
Project-URL: Documentation, https://github.com/bug4fix/totoon#readme
Project-URL: Repository, https://github.com/bug4fix/totoon
Project-URL: Issues, https://github.com/bug4fix/totoon/issues
Keywords: toon,json,llm,data-format,converter
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Provides-Extra: publish
Requires-Dist: build>=0.10.0; extra == "publish"
Requires-Dist: twine>=4.0.0; extra == "publish"
Dynamic: license-file

# totoon

**totoon** - Convert any data format to TOON (Token-Oriented Object Notation)

TOON is a compact data format that reduces token usage by 30-60% compared to JSON when interfacing with Large Language Models (LLMs).

[![GitHub](https://img.shields.io/github/license/bug4fix/totoon)](https://github.com/bug4fix/totoon)
[![GitHub stars](https://img.shields.io/github/stars/bug4fix/totoon)](https://github.com/bug4fix/totoon)

## Features

- 🚀 Convert JSON, YAML, XML, and more to TOON format
- 📦 Multi-language SDK support (starting with Python)
- ⚡ High-performance conversion
- 🔧 Easy to integrate
- 📚 Comprehensive documentation

## Installation

### Python

```bash
pip install totoon
```

## Quick Start

### Python

```python
from totoon import to_toon

# Convert Python dict to TOON
data = {
    "users": [
        {"name": "Alice", "age": 30},
        {"name": "Bob", "age": 25}
    ]
}

toon_output = to_toon(data)
print(toon_output)
```

Output:
```
users:
  name | age
  --- | ---
  Alice | 30
  Bob | 25
```

### Convert from JSON

```python
from totoon import json_to_toon

json_str = '{"name": "Alice", "age": 30}'
toon_output = json_to_toon(json_str)
print(toon_output)
```

### Convert from YAML

```python
from totoon import yaml_to_toon

yaml_str = """
users:
  - name: Alice
    age: 30
  - name: Bob
    age: 25
"""
toon_output = yaml_to_toon(yaml_str)
print(toon_output)
```

## Why TOON?

TOON (Token-Oriented Object Notation) is designed specifically for LLM interactions:

- **30-60% token reduction** compared to JSON
- **Tabular format** for arrays of objects (common in LLM data)
- **Human-readable** while being compact
- **Efficient** for API calls to LLMs

### Example Comparison

**JSON:**
```json
{
  "users": [
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 25}
  ]
}
```
*~80 tokens*

**TOON:**
```
users:
  name | age
  --- | ---
  Alice | 30
  Bob | 25
```
*~35 tokens (56% reduction!)*

## Supported Formats

- ✅ JSON
- ✅ YAML
- ✅ XML
- 🔄 CSV (coming soon)
- 🔄 TOML (coming soon)

## Language Support

- ✅ Python
- ✅ JavaScript/TypeScript
- ✅ Go
- ✅ Rust

## Repository

- **GitHub**: https://github.com/bug4fix/totoon
- **Issues**: https://github.com/bug4fix/totoon/issues
- **Discussions**: https://github.com/bug4fix/totoon/discussions

## License

MIT License - See [LICENSE](LICENSE) file for details

## Contributing

Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md).


## Business Model

This project follows an **Open Source + Enterprise SaaS** model:
- **Open Source**: Core SDKs are free and open source
- **Enterprise**: Cloud API, advanced features, and support available for enterprise customers (coming soon)

