Skip to main content

T-TOON Batch API

This page groups the non-streaming APIs that produce or consume T-TOON text. Use the language tabs to switch between Python, JavaScript, and Rust.

Batch parse APIs still auto-detect T-TOON, T-JSON, and typed_unit input. The functions listed here are grouped by their T-TOON use case, not by exclusive parser support.

Package: ttoon

The current Python package depends on pyarrow>=23.0.0 and polars>=1.37.1.

Read T-TOON Batch Text

loads(text, mode=None) -> object

  • Parses T-TOON, T-JSON, or typed_unit text to Python native objects
  • mode: "compat" (default) or "strict"
  • mode only affects the T-TOON parse path

read_arrow(text) -> pyarrow.Table

  • Parses batch text directly to pyarrow.Table
  • Auto-detects input format
  • Input must be a list of uniform objects with scalar fields

Write T-TOON Batch Text

dumps(obj, delimiter=",", indent_size=None, binary_format=None) -> str

  • Serializes Python native objects to T-TOON text
  • Also accepts pyarrow.Table, pyarrow.RecordBatch, and polars.DataFrame
  • Arrow / Polars input routes to the Arrow path automatically
  • Uniform object lists output as tabular [N]{fields}:

Transcode into T-TOON

tjson_to_ttoon(text, *, delimiter=",", indent_size=None, binary_format=None) -> str

  • Converts T-JSON text directly to T-TOON through Rust IR only
  • Always uses strict T-JSON parsing
  • Does not accept a mode parameter

T-TOON Batch Options

ParameterAPIsValuesDefault
delimiterdumps, tjson_to_ttoon",", "\t", `""`
indent_sizedumps, tjson_to_ttoonint | NoneNone
binary_formatserialize / transcode APIs above"hex", "b64""hex"
modeloads"compat", "strict""compat"
  • detect_format(text) -> str is documented on Format Detection
  • Python codec registration does not affect loads() or batch transcode; it is mainly relevant to streaming APIs