Skip to main content

🚀 TOON Converter (Python)

A lightweight library to convert between TOON (Token-Oriented Object Notation) and popular data formats (JSON, YAML, XML, CSV).

Reduce your LLM token costs by up to 40% using the TOON format!

📦 Installation

pip install toon-parse

🚀 Quick Start

from toon_parse import ToonConverter

# JSON to TOON
data = {"name": "Alice", "age": 30, "active": True}
toon_string = ToonConverter.from_json(data)
print(toon_string)
# Output:
# name: "Alice"
# age: 30
# active: true

# TOON to JSON
json_output = ToonConverter.to_json(toon_string)
print(json_output)

⚡ Async Usage

For non-blocking operations in async applications, use AsyncToonConverter:

import asyncio
from toon_parse import AsyncToonConverter

async def main():
    data = {"name": "Alice", "age": 30}
    
    # Async conversion
    toon_string = await AsyncToonConverter.from_json(data)
    print(toon_string)
    
    # Async parsing
    json_output = await AsyncToonConverter.to_json(toon_string)
    print(json_output)

asyncio.run(main())

📚 API Reference

The Python API mirrors the JavaScript API with snake_case naming conventions.

  • ToonConverter.from_json(data)
  • ToonConverter.to_json(toon_string)
  • ToonConverter.from_yaml(yaml_string)
  • ToonConverter.to_yaml(toon_string)
  • ToonConverter.from_xml(xml_string)
  • ToonConverter.to_xml(toon_string)
  • ToonConverter.from_csv(csv_string)
  • ToonConverter.to_csv(toon_string)
  • ToonConverter.validate(toon_string)
  • AsyncToonConverter.* (same methods as above, but async)

📄 License

MIT License

Metadata

Release files for toon-parse 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toon-parse 1.0.3
File Size Uploaded Provenance Actions
toon_parse-1.0.3.tar.gz 14.9 kB Without provenance Details for toon_parse-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toon-parse 1.0.3
File Interpreter ABI Platform Actions
toon_parse-1.0.3-py3-none-any.whl Python 3 none any Details for toon_parse-1.0.3-py3-none-any.whl

Total release size: 29.6 kB

Release files / toon_parse-1.0.3.tar.gz

Download URL toon_parse-1.0.3.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1ca00e6076f074a182c0da628a5683f20e3df68e847df319c07eaf8ebf53d31
BLAKE2b-256 checksum
How to use checksums
657fb21d45aecdb3822a979e5f79d2257d8211c0793694776c1b6955afed3a34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / toon_parse-1.0.3-py3-none-any.whl

Download URL toon_parse-1.0.3-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23018beec508ea65dc0512707249b36e8b6e6d59225f208fd8e85dbf73535822
BLAKE2b-256 checksum
How to use checksums
c510cddd499259e38103a5a51ab91c06fef5a430ddbe52631639bd45fcc4e969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for toon-parse 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page