Re: json vs simplejson

2012-06-12 Thread Alex Ogier
On Tue, Jun 12, 2012 at 8:49 AM, Luke Plant wrote: > > I agree my existing program had a bug. I had simplejson installed > because a dependency pulled it in (which means it can be difficult to > get rid of). > > The thing I was flagging up was that the release notes say

Re: json vs simplejson

2012-06-12 Thread Luke Plant
On 12/06/12 13:28, Alex Ogier wrote: > 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

Re: json vs simplejson

2012-06-12 Thread Alex Ogier
On Tue, Jun 12, 2012 at 7:19 AM, Luke Plant 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

Re: json vs simplejson

2012-06-12 Thread Alex Ogier
On Jun 12, 2012 6:54 AM, "Luke Plant" wrote: > I've found the same difference of behaviour on both a production machine > where I'm running my app (CentOS machine, using a virtualenv, Python > 2.7.3), and locally on my dev machine which is currently running Debian, > using

Re: json vs simplejson

2012-06-12 Thread Luke Plant
On 12/06/12 10:58, Vinay Sajip wrote: > > I'm not sure there's any easy way out, other than comprehensive > testing. There is another issue I found. Django's DateTimeAwareJSONEncoder now subclasses json.JSONEncoder instead of simplejson.JSONEncoder. The two are not perfectly compatible.

Re: json vs simplejson

2012-06-12 Thread Luke Plant
On 12/06/12 06:14, Alex Ogier wrote: > This seemed strange to me because the standard library json shipping > with python 2.7.3 is in fact simplejson 2.0.9, so I did some digging. > It turns out that if the C extensions have been compiled and you pass > a str instance to loads(), then you get

Re: json vs simplejson

2012-06-12 Thread Vinay Sajip
On Jun 11, 10:51 pm, Luke Plant wrote: > We've switched internally from json to simplejson. Our 1.5 release notes > say: Do you mean the other way around? > You can safely change any use of django.utils.simplejson to json > > I just found a very big difference between

Re: json vs simplejson

2012-06-11 Thread Alex Ogier
On Mon, Jun 11, 2012 at 5:51 PM, Luke Plant wrote: > > i.e. simplejson returns bytestrings if the string is ASCII (it returns > unicode objects otherwise), while json returns unicode objects always. > This seemed strange to me because the standard library json shipping

Re: json vs simplejson

2012-06-11 Thread schinckel
The other thing this breaks is using **kwargs with something loaded from JSON. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-developers/-/ynPxXsJZUB8J. To

json vs simplejson

2012-06-11 Thread Luke Plant
Hi all, We've switched internally from json to simplejson. Our 1.5 release notes say: You can safely change any use of django.utils.simplejson to json I just found a very big difference between json and simplejson >>> simplejson.loads('{"x":"y"}') {'x': 'y'} >>> json.loads('{"x":"y"}') {u'x':