Skip to content

Serialization Attributes

Enables serialization generation.

#[SerializationType("binary")]
#[SerializationType("json")]
[SerializationType("json")]
model UserInfo {
Id: string;
}

Supported values are:

  • binary
  • json

The attribute can be global or model-local, and can be language-scoped.

#[$go,$ts:SerializationType("json")]

Controls binary serialization byte order where supported.

#[BinarySerializationEndian("little")]
#[BinarySerializationEndian("big")]

Supported values are:

  • little
  • big
  • small, accepted as an alias for little

When omitted, binary serialization defaults to little-endian behavior.

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.

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.