annotation XMLT::Field

Overview

Modifies the serialization and deserialization of a property based on the keys set. Not all keys work for serializing or deserializing, see the available keys to find out which apply to serializing/deserializing.

Available keys:

key: the name of the property or element to serialize to / deserialize from (default is the property name).

item_key: the name of the item key, this only applies to Arrays, Deques, Tuples, and Sets (default is "item").

ignore: ignore the field when serializing and deserializing (default is false).

ignore_serialize: ignore the field when serializing.

ignore_deserialize: ignore the field when deserializing.

omit_nil: ignore serializing the property if it is nil (default is false).

new_root: overrides the default root element to deserialize from. This is required if you are serializing a class or struct within another as the root element becomes ambiguous to the deserializer.

Defined in:

annotations.cr