In Prototype.js 1.6.x try and do
Object.toJSON([{"nodeType":1}])
it should yield
'[{"nodeType":1}]'
as the output string. However it yields '[]'. It appears to skip objects that have nodeType==1. It has something to do with them being DOM elements. Is there a work around to get the correct output?
jsFiddle: http://jsfiddle.net/xPVnr/
EDIT:
Looking at the source it appears toJSON just returns if isElement(obj) is true which is in turn true if obj.nodeType == 1 :(