Loading ...
Sorry, an error occurred while loading the content.

539json.js breaks for-in loops

Expand Messages
  • Peter Michaux
    Oct 13, 2006
    • 0 Attachment
      Hi,

      By extending the Object.prototype with the new property toJSONString I
      can no longer use for-in loops in my JavaScript.

      Has someone released a version of JSON that doesn't do this?

      Is it just as simple as changing these

      Object.prototype.toJSONString = function () {
      Array.prototype.toJSONString = function () {
      String.prototype.parseJSON = function () {

      to something like

      JSON.objectToJSONString = function () {
      JSON.arrayToJSONString = function () {
      JSON.parseJSON = function () {

      or are their other catches that I have missed?

      Thank you,
      Peter
    • Show all 10 messages in this topic