title: Why do JavaScript objects not have a toJSON() method?
body: <p>As described at <a href="http://www.json.org/js.html" rel="noreferrer">http://www.json.org/js.html</a>, JavaScript objects can dictate how they are serialized by JSON.stringify() by implementing a toJSON() method. For an arbitrary object, this method is not defined, while numbers and strings seem to implement the method. I'm curious--why do objects not have an implementation?</p>
  
  <p>EDIT: I originally mentioned that arrays have this method--they do not. I apologize for the confusion.</p>