couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject upgrading to json2.js
Date Sun, 20 Dec 2009 01:07:22 GMT
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:

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

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 Anderson

View raw message