Hello all,

I'm following the "Serializing Django objects" documentation and have a
view pretty much verbatim from the docs:

def my_json_view(request):
    data = serializers.serialize("json", Location.objects.all())
    return HttpResponse(data, mimetype='text/javascript')

My Location model includes decimal latitude and longitude data. When I
test the above view using the Django shell, it works, but when I try it
via a browser request, I get this:

Decimal("44.048708") is not JSON serializable
Request Method:         GET
Request URL:    http://www.my_url.com/maps/json/
Exception Type:         TypeError
Exception Value:        Decimal("44.048708") is not JSON serializable
Exception Location:      ... [snip] ...
/django/utils/simplejson/encoder.py in default, line 258

Also, the above will works via the browser when I specify "xml" as the
serialization format. The "json" format just doesn't like my decimals.
What am I doing wrong?

Thanks for any guidance,
John


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to