Skip to main content

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

Project description

🚀 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_formatter 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)

📚 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)

📄 License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toon_parse-1.0.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toon_parse-1.0.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file toon_parse-1.0.1.tar.gz.

File metadata

  • Download URL: toon_parse-1.0.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for toon_parse-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e6d35cf9cebc204a7c6d36b9c28276cb1f69a7f01e0aa4ffd1e73491aad98f31
MD5 8ab8a2585c00000c44f9fa14e3150882
BLAKE2b-256 cbd0af33ad4cc1f94c70271d6a31b59f5d4cfe2ec149b4dad6ce02fff13824a9

See more details on using hashes here.

File details

Details for the file toon_parse-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: toon_parse-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for toon_parse-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0aebb151d6173a08ad2be1896ce67d9294345dcafae43e2bc6634e7488c5f82a
MD5 0abe303caedf8da33c747db9c458b7e0
BLAKE2b-256 985358cbfff9ae5e8773148f69e48db86c1f465722397dbd13db6010489b499f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page