[Web-SIG] Time a for JSON parser in the standard library?

Deron Meranda deron.meranda at gmail.com
Fri Mar 21 01:03:40 CET 2008


On Thu, Mar 20, 2008 at 7:50 PM, Bob Ippolito <bob at redivi.com> wrote:
>  >  Anyway, to get JSON in UTF-8, I'm calling it like this:
>  >
>  >   simplejson.dumps( ["\x1a"], ensure_ascii=False ).encode('utf8')
>  >
>  >  which on my system outputs this:   '["\x1a"]'
>  >  rather than this:  '["\\u001a"]'
>  >
>  >  If I change the ensure_ascii to its default of True, then I do get
>  >  the correct results.
>
>  Okay, so I was using the default settings, which is ensure_ascii=True,
>  and I was getting correct results. I didn't know you were testing with
>  ensure_ascii=False.

I almost missed that one myself too.  That's why I finally decided to
get so detailed, to find little things like that.  I also found a few bugs
in mine as well by doing this exercise (although I had the advantage
of fixing mine before anybody could see :)

I assume that will be a really easy fix for you.  But, I am using it the
right way though, aren't I?
-- 
Deron Meranda


More information about the Web-SIG mailing list