Serialization Attributes
SerializationType
Section titled “SerializationType”Enables serialization generation.
#[SerializationType("binary")]#[SerializationType("json")]
[SerializationType("json")]model UserInfo { Id: string;}Supported values are:
binaryjson
The attribute can be global or model-local, and can be language-scoped.
#[$go,$ts:SerializationType("json")]BinarySerializationEndian
Section titled “BinarySerializationEndian”Controls binary serialization byte order where supported.
#[BinarySerializationEndian("little")]#[BinarySerializationEndian("big")]Supported values are:
littlebigsmall, accepted as an alias forlittle
When omitted, binary serialization defaults to little-endian behavior.
StrictBinaryParsing
Section titled “StrictBinaryParsing”Controls what generated binary deserializers do when the input ends before all model fields are read.
#[StrictBinaryParsing(false)]When omitted, strict binary parsing is enabled. Strict parsing returns the target language’s failure value when required bytes are missing.
When set to false, supported generators return the partially parsed model instead. This is useful for local save data where newer schema fields should keep their default values when reading older binary data.
The attribute can be global or model-local, and can be language-scoped.
UseWGodot
Section titled “UseWGodot”Controls whether the GDScript binary generator emits WGodot-friendly get_data reads.
#[$gd:UseWGodot(true)]When set to true, the gd codegen will generate code for WGodot engine (instead of normal Godot). Please note that the generated WGodot code might not work in normal Godot engine (e.g. it may use methods/functions that only exist in WGodot engine).
When omitted, the value defaults to false.
The attribute can be global or model-local, and can be language-scoped.