According to information from http://www.json.org/js.html, JavaScript objects can specify how they are serialized by JSON.stringify() through the use of a toJSON() method. It is interesting to note that numbers and strings appear to have this method, but for arbitrary objects it is not defined. I wonder why objects do not have an implementation of this method.
UPDATE: In my previous statement, I incorrectly mentioned that arrays have this method - in reality, they do not. I apologize for any confusion caused.