Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Type Reference

Complete reference table for all TeaLeaf types, their text syntax, binary encoding, and language mappings.

Primitive Types

TeaLeaf TypeText SyntaxBinary CodeBinary SizeRust TypeC# Type
booltrue / false0x011 byteboolbool
int8420x021 bytei8sbyte
int1610000x032 bytesi16short
int / int321000000x044 bytesi32int
int6450000000000x058 bytesi64long
uint82550x061 byteu8byte
uint16655350x072 bytesu16ushort
uint / uint321000000x084 bytesu32uint
uint64184467440737095516150x098 bytesu64ulong
float323.140x0A4 bytesf32float
float / float643.140x0B8 bytesf64double
string"hello" / hello0x104 bytes (index)Stringstring
bytesb"cafef00d"0x11varint + dataVec<u8>byte[]
json_number(from JSON)0x124 bytes (index)Stringstring
timestamp2024-01-15T10:30:00Z0x3210 bytes(i64, i16)DateTimeOffset

Special Types

TeaLeaf TypeText SyntaxBinary CodeDescription
null~0x00Null/missing value

Container Types

TeaLeaf TypeText SyntaxBinary CodeDescription
Array[1, 2, 3]0x20Ordered collection
Object{key: value}0x21String-keyed map
Struct(val, val, ...) in @table0x22Schema-typed record
Map@map {key: value}0x23Any-keyed ordered map
Tuple(val, val, ...)0x24 (reserved)Currently parsed as array

Semantic Types

TeaLeaf TypeText SyntaxBinary CodeDescription
Ref!name0x30Named reference
Tagged:tag value0x31Discriminated value

Type Modifiers

ModifierSyntaxDescription
Nullabletype?Field can be ~ (null)
Array[]typeArray of the given type
Nullable array[]type?The field itself can be null

Type Widening Path

int8 → int16 → int32 → int64
uint8 → uint16 → uint32 → uint64
float32 → float64

Widening is automatic when reading binary data. Narrowing requires recompilation.

JSON Mapping

TeaLeaf TypeJSON OutputJSON Input
Nullnullnull → Null
Booltrue/falseboolean → Bool
Intnumberinteger → Int
UIntnumberlarge integer → UInt
Floatnumberdecimal → Float
String"text"string → String
Bytes"0xhex"(not auto-detected)
JsonNumbernumberlarge/precise number → JsonNumber
Timestamp"ISO 8601"(not auto-detected)
Array[...]array → Array
Object{...}object → Object
Map[[k,v],...](not auto-detected)
Ref{"$ref":"name"}(not auto-detected)
Tagged{"$tag":"t","$value":v}(not auto-detected)