couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: upgrading to json2.js
Date Tue, 22 Dec 2009 18:26:32 GMT
On Sat, Dec 19, 2009 at 5:07 PM, Chris Anderson <> wrote:
> It's well known that in order to take advantage of native JSON
> libraries in the newest Mozilla JavaScript VMs, we'll need to change
> our handling of 'undefined' in the toJSON() routine.
> I propose we make this change now, by replacing our current JSON
> handling with json2.js, the current reference implementation.
> I've started the work here:

I've update my json2 branch to reflect my latest commits to trunk.

Benoit has fixed the E4X issues. There are a few other test failures
which I believe have to do with the changed behavior. If anyone wants
to take a look at these and consider changing the tests where
appropriate, that'd be super helpful.


> Everything works except E4X. When I run the view_xml tests, I see this
> error in the logs:
> OS Process :: function raised exception (TypeError:
> String.prototype.toJSON called on incompatible XML) with doc._id
> 43840f81289e03fec4e9f620b2c03799
> In our old implementation of toJSON, we run value.toXMLString() to
> convert XML to strings. json2.js takes a callback parameter to allow
> modification of results, but the TypeError is triggered before the
> callback, it seems.
> If any of you JavaScript ninjas wanna give this a shot, please help me
> finish it.
> Chris
> --
> Chris Anderson

Chris Anderson

View raw message