TOON (Token-Oriented Object Notation) serializer & parser for Python
Project description
python-toon-parser
python-toon-parser — TOON (Token-Oriented Object Notation) serializer and parser for Python.
Installation
pip install python-toon-parser
Features
- Human-Readable: Minimal syntax, similar to YAML but distinct.
- Round-Trip:
dumps(obj)->loads(text)preserves structure. - Compact Tables: Automatically detects lists of uniform objects and formats them as compact tables.
- Broad Support: Handles
dict,list,tuple,set,dataclasses,namedtuples, and simple objects.
Quickstart
from pytoon import dumps, loads
data = {"items": [{"id":1,"name":"A"}, {"id":2,"name":"B"}]}
# Serialize
s = dumps(data)
print(s)
# Parse back
obj = loads(s)
print(obj)
Output:
items[2]{id,name}:
1,A
2,B
API Reference
dumps(obj, name=None, indent=0) -> str
Serializes a Python object to a TOON string.
obj: The object to serialize.name: (Optional) Root key name for the object.indent: (Optional) Starting indentation level (default 0).
loads(toon_str) -> Any
Parses a TOON string back into Python objects.
- Returns
dict,list, or primitive depending on the input.
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
python_toon_parser-0.1.1.tar.gz
(12.1 kB
view details)
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 python_toon_parser-0.1.1.tar.gz.
File metadata
- Download URL: python_toon_parser-0.1.1.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7225b6d39354759b34ede6181696d3a72a905bbcf73315eaf7e1054fd62e7a0
|
|
| MD5 |
2137ac56a02de8efb5f0996a7e00d554
|
|
| BLAKE2b-256 |
1cf379f69e4c9602d3e4c5a7d89ba80a55423f751c7685df07fd7b523dc35a94
|
File details
Details for the file python_toon_parser-0.1.1-py3-none-any.whl.
File metadata
- Download URL: python_toon_parser-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40ceed7e0dc76d25881e3bf4dc2d910ad146082195c9222e4d0fe1b705dcecd6
|
|
| MD5 |
d25368b90b3bc33852a1d85cb93d0946
|
|
| BLAKE2b-256 |
6857f2dda4db3165b0e1da9cec77b6af276a1bd06f4a9433dca65d2acacb9be0
|