#3324: FloatFields are converted to decimal and simplejson cannot serialize
------------------------------+---------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: reopened | Component: Serialization
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
------------------------------+---------------------------------------------
Comment (by [EMAIL PROTECTED]):
== Editable code to paste into the Python command line ==
from the make-it-dead-simple-for-the-django-dev dept:
{{{
#!html
<textarea style="color: green" cols="78" rows="10">
from django.utils.simplejson import JSONEncoder
from decimal import Decimal
from django.utils import simplejson
decimal_num = Decimal("1.23")
s = JSONEncoder().encode({"foo": [decimal_num,]})
print s
d = simplejson.loads(s)
print d
print type(d['foo'][0])
</textarea>
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/3324#comment:7>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---