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

📚 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.2.tar.gz (14.0 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.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: toon_parse-1.0.2.tar.gz
  • Upload date:
  • Size: 14.0 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.2.tar.gz
Algorithm Hash digest
SHA256 0e8139eb134c285027fe7e33755985532e209e61c51154abfc5bc10f3d0c8612
MD5 8f117ab05da53703d6f8af37535d28ca
BLAKE2b-256 cc5c96a0b85d9283dac6d551653ac8e73892f9b43d0fcf9b57c3858e4994e327

See more details on using hashes here.

File details

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

File metadata

  • Download URL: toon_parse-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6274c957afad6a43b15e60959b49831de2554a703e38eb078e25a5ecb6ac9f82
MD5 bed57ed46676938e3792a3ecee21ed22
BLAKE2b-256 e88345b3e43fc4e8715b1f90c3f3f690372dbfee0f77a04f9325fc09003b039f

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