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

Bob Ippolito bob at redivi.com
Sun Mar 16 19:47:14 CET 2008


I wasn't subscribed to the list at the time this came up, but I'm all
for getting simplejson into the stdlib. We use it a lot here at Mochi
Media and we're willing to support it in or out of the stdlib. I'm
willing to sign over copyright to the PSF and/or relicense and help
with whatever else needs to happen, just let me know.

As far as the reading of non-BMP unicode goes, give me a test and
we'll fix it. So far nobody has sent any bug reports related to
unicode, so I'm willing to wager that nobody actually cares, but I'd
still like to do it correctly. I haven't tried very hard because I use
a UCS2 build of Python on my workstation and I don't know enough about
unicode edge cases to craft a proper suite.

Practically speaking I've tried using decimal instead of float for
JSON and it's generally The Wrong Thing To Do. The spec doesn't say
what to do about numbers, but for proper JavaScript interaction you
want to do things that approximate what JS is going to do: 64-bit
floating point. Encoding floats with repr might be the wrong thing to
do because the representation is long, but ideally repr in Python
would use a better algorithm[1]. Changing from repr to str is trivial
and beneficial so I've already put that on the trunk.

[1] http://www.cs.indiana.edu/~burger/fp/index.html

-bob


More information about the Web-SIG mailing list