Skip to content

annotation Athena::Serializer::Annotations::IgnoreOnDeserialize #

Indicates that a property should not be set on deserialization, but should be serialized.

Example#

class Example
  include ASR::Serializable

  property name : String

  @[ASRA::IgnoreOnDeserialize]
  property password : String?
end

obj = ASR.serializer.deserialize Example, %({"name":"Jim","password":"monkey123"}), :json

obj.password # => nil
obj.name     # => Jim

obj.password = "foobar"

ASR.serializer.serialize obj, :json # => {"name":"Jim","password":"foobar"}