Token-Oriented Object Notation (TOON) parser for Python
Project description
TOON Parser (Python)
TOON (Token-Oriented Object Notation) is a human-readable data format optimized for Large Language Models (LLMs). This is the Python implementation of the TOON parser.
Installation
pip install toon-format-parser
Quick Start
import toon_parser
# Encode Python data to TOON format
data = {
"sessionId": "abc-123",
"users": [
{ "name": "Alice", "role": "admin" },
{ "name": "Bob", "role": "user" }
]
}
toon_string = toon_parser.encode(data)
print(toon_string)
# Output:
# sessionId: abc-123
# users: items[2]{name,role}:
# Alice,admin
# Bob,user
# Decode back to Python
decoded = toon_parser.decode(toon_string)
print(decoded)
Features
- Collection Markers: Full support for
items[N]:anditems[N]{headers}:. - Tabular Arrays: Efficient CSV-like representation for object arrays.
- Ambiguity Resolution: Robust parsing for nested structures.
- LLM Optimized: Minimizes tokens by removing redundant brackets and quotes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toon_format_parser-1.1.0.tar.gz.
File metadata
- Download URL: toon_format_parser-1.1.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e089bed76487e1ace8d6b124fee9675e45d134a2449c1f11d619d97622a4108
|
|
| MD5 |
836b9d47dd9849bef83f8b7d3cc4cb6b
|
|
| BLAKE2b-256 |
b7473a88432791373613b4a5b93efc53f4f79da997b86ea54c10e6707b5019c6
|
File details
Details for the file toon_format_parser-1.1.0-py3-none-any.whl.
File metadata
- Download URL: toon_format_parser-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4286aeab2120e3cbe7a63a2fe2565b7d6db9238bebe724920b845802aa9196df
|
|
| MD5 |
75df35cdc51c5ddcbf7da9a3fea4cce0
|
|
| BLAKE2b-256 |
ca166769fe90ab959180591a01f67746a0133c0fc8828b28a385442f849efef3
|