On Tue, Jun 12, 2012 at 7:19 AM, Luke Plant <l.plant...@cantab.net> wrote: > > There is another issue I found. > > Django's DateTimeAwareJSONEncoder now subclasses json.JSONEncoder > instead of simplejson.JSONEncoder. The two are not perfectly compatible. > simplejson.dumps() passes the keyword argument 'namedtuple_as_object' to > the JSON encoder class that you pass in, but json.JSONEncoder doesn't > accept that argument, resulting in a TypeError. > > So any library that uses Django's JSONEncoder subclasses, but uses > simplejson.dumps() (either via 'import simplejson' or 'import > django.utils.simplejson') will break. I found this already with > django-piston. >
Wait, 'import simplejson' works? Then that explains your problems. You are using a library you installed yourself that has C extensions, instead of the system json. If you switch to a system without simplejson installed, then you should see the "proper" behavior from django.utils.simplejson.loads(). If your program depends on some optimized behavior of the C parser such as returning str instances when it finds ASCII, it is bugged already on systems without simplejson. If Django depends on optimized behavior, then it is a bug, and a ticket should be filed. Best, Alex Ogier -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.