title: Django newbie question
body: <p>I have this code :</p>
  
  <pre><code>def encode_myway(obj):
       if isinstance(obj, User):
          data = dict()
          data['username'] = obj.username
          data['code'] = obj.code //a number = 30
       return data
  </code></pre>
  
  <p>I'm serializing for json using <code>simplejson.dumps(resp, default=encode_myway)</code> the problem I have is that code (an integer) is equal to NULL but if I use <code>serializers.serialize("json", [resp,])</code> I got a lot of garbage in my json but the integers are correct.. for garbage I refer to something like this :</p>
  
  <pre><code>"[{\"pk\":\29,\\"model\":\\"smapp.userprofile\",\\"fields\":\{\"city\":\\"barcelona\", ... }}]"
  </code></pre>