annotation CrSerializer::Annotations::IgnoreOnDeserialize

Overview

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

class Example
  include CrSerializer

  def initialize; end

  property name : String

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

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

obj.password # => nil

obj.password = "foobar"

obj.to_json # => {"name":"Jim","password":"foobar"}

Defined in:

annotations.cr