Outbound Link Summary:
19 years ago
p3k dots

the "official" json for javascript implementation cannot parse or stringify regexp objects. it looks like an "internet explorer" implementation, anyway. (outdated, that is; or at least very exaggeratingly backwards-compatible.)

my stringify method would look like this (and it can cope with regexp objects – with any javascript object):

JSON.stringify = function(arg) {
   var src = arg.toSource();
   return src.substring(1, src.length-1);
};

thus, (IF ANYTHING) i would adapt json.org's stringify method to become the missing toSource method of javascript versions smaller than 1.3.

thanks to rhino, my stringify version works in helma without any troubles.