title: pydantic `json_encoders` for builtin types (float, int, etc)
body: <p>I'm having some unexpected behavior with json encoding of fields like <code>float</code>, <code>int</code>, etc. using pydantic.  Here is the <a href="https://pydantic-docs.helpmanual.io/usage/exporting_models/#json_encoders" rel="nofollow noreferrer">documentation</a> for json encoding, for reference.</p>
  <p>As an example, this model seems to encode <code>complex</code> just fine, but ignores my <code>float</code> field.</p>
  <pre class="lang-py prettyprint-override"><code>import pydantic as pd
  
  class Model(pd.BaseModel):
      class Config:
          arbitrary_types_allowed=True
          json_encoders = {
              float: lambda x: 'test',
              complex: lambda x: 'test'
          }
      d1:float
      d2:complex
  
  m = Model(d1=1.0, d2=1j)
  m.json()
  # '{&quot;d1&quot;: 1.0, &quot;d2&quot;: &quot;test&quot;}'
  </code></pre>
  <p>Can anyone shine light on this behavior and point me in the right direction?</p>
  <p>My use case is a custom encoder to detect when a <code>float</code> is <code>numpy.inf</code> and then write it to <code>&quot;Infinity&quot;</code> in json rather than the illegal default value of <code>Infinity</code> as encoded by the <code>json</code> package.</p>
  <p>Thanks for your help!</p>