Skip to main content

T-JSON Batch API

This page groups the non-streaming APIs that produce or consume T-JSON 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-JSON use case, not by exclusive parser support.

Package: ttoon

Read T-JSON Batch Text

loads(text, mode=None) -> object

  • Parses T-JSON, T-TOON, or typed_unit text to Python native objects
  • mode only affects the T-TOON parse path

read_arrow(text) -> pyarrow.Table

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

Write T-JSON Batch Text

to_tjson(obj, binary_format=None) -> str

  • Serializes Python objects to T-JSON text
  • Does not accept Arrow / Polars input

stringify_arrow_tjson(obj, binary_format=None) -> str

  • Serializes pyarrow.Table, pyarrow.RecordBatch, or polars.DataFrame to T-JSON list-of-objects

Transcode into T-JSON

ttoon_to_tjson(text, *, mode="compat", binary_format=None) -> str

  • Converts T-TOON text directly to T-JSON through Rust IR only
  • mode: "compat" (default) or "strict"

T-JSON Batch Options

ParameterAPIsValuesDefault
binary_formatto_tjson, stringify_arrow_tjson, ttoon_to_tjson"hex", "b64""hex"
modeloads, ttoon_to_tjson"compat", "strict""compat"
  • detect_format(text) -> str is documented on Format Detection
  • TranscodeError details remain the same regardless of which batch format you target