struct CustomPolicy {} struct Test { // serialized as "screen-size": @name("screen-size") int screenSize; // serialized as "print-size" by default, // but as "PRINTSIZE" if CustomPolicy is used for serialization. @name("print-size") @name!CustomPolicy("PRINTSIZE") int printSize; // serialized as "version" int version_; }
Attribute for overriding the field name during (de-)serialization.
Note that without the @name attribute there is a shorter alternative for using names that collide with a D keyword. A single trailing underscore will automatically be stripped when determining a field name.