title: Serialize models in django with proper decimal data types into json
body: <p>Here is a sample model:</p>
  
  <pre><code>class FooModel(models.Model):
      foo = models.DecimalField(max_digits=6, decimal_places=3, null=True)
  </code></pre>
  
  <p>Serialize:</p>
  
  <pre><code>from django.core import serializers
  obj = get_object_or_404(FooModel, pk=1)
  data = serializers.serialize("json", [obj])
  </code></pre>
  
  <p>That will return something like:</p>
  
  <pre><code>[
      {
          "pk": 1,
          "model": "app.foomodel",
          "fields": {
              "foo": "50"
          }
      }
  ]
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>How can I make foo field to serialize as float, and not as string. I don't want to use float model type since float sometimes does not store decimals correctly.</p>
  
  <p>Thank you in advance.</p>