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

Robert Brewer fumanchu at aminus.org
Fri Mar 21 04:38:42 CET 2008


Bob Ippolito wrote:
> On Thu, Mar 20, 2008 at 5:50 PM, Robert Brewer <fumanchu at aminus.org>
> wrote:
> > Deron Meranda wrote:
> > > And even then, we're not just talking about a JSON parser.
> > > We're all doing more than that; we're mapping Python to JSON.
> > > And there is no definitive spec for that.  Just look at my
> > > numbers tests; there are a lot of differences in how numeric
> > > mappings are done, but yet many of them can be arguably
> > > "correct" while still doing things differently.
> >
> >  ...which IMO argues that any json implementation that goes
> > in the stdlib needs to at least allow access to the raw bytes
> > in both directions. For example, if you really want JSON
> > numerals to become Python decimals, you shouldn't be forced
> > to lose information just because the json decoder was only
> > designed to hand you a float. Arbitrary converter plugins would
> > be icing on the cake. A built in decimal converter would be
> > heaven. :)
> 
> That can be easily done, but at the expense of speed or clarity in the
> implementation... I'd be willing to add some hooks to simplejson that
> allow people to pass in their own functions that turn JSON terms (as
> strings) into Python objects.

That'd be great! I expect a speed penalty of course, and IMO most of that should be pushed onto anyone passing in functions, rather than making everyone pay.


Robert Brewer
fumanchu at aminus.org



More information about the Web-SIG mailing list