title: Why can't I override `to_dict` method of a `dataclass` object that uses `dataclasses_json`?
body: <p><a href="https://lidatong.github.io/dataclasses-json/" rel="nofollow noreferrer">dataclasses_json</a> is a library that provides JSON capabilities to python's data classes. I noticed that overriding <code>to_dict</code> method has no effect. Here's an example:</p>
  
  <pre><code>@dataclass_json
  @dataclass
  class Message2:
      message: str
      weight: int
      def to_dict(self, encode_json=False):
          print('Custom to_dict')
          ret = {'MESSAGE': self.message, 'WEIGHT': self.weight}
          return ret
  m2 = Message2('m2', 2)
  print(m2.to_dict())
  </code></pre>
  
  <p>The code prints the following:</p>
  
  <p>{'message': 'm2', 'weight': 2}</p>
  
  <p>While I was expecting </p>
  
  <pre><code>Custom to_dict
  {'MESSAGE': 'm2', 'WEIGHT': 2}
  </code></pre>
  
  <p>If I remove the <code>@dataclass_json</code> line, I get the desired output.</p>
  
  <p>So, my questions are:</p>
  
  <ol>
  <li><p>Why defining a function had no effect with <code>@dataclass_json</code> but worked without it?</p></li>
  <li><p>How can I override <code>to_dict</code> and use <code>@dataclass_json</code>?</p></li>
  </ol>