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

589Re: [json] Re: json.js breaks for-in loops

Expand Messages
  • Martin Cooper
    Nov 13, 2006
    • 0 Attachment
      On 11/13/06, Stephen M. McKamey <jsonml@...> wrote:
      >
      > // This should do what you are asking for while staying
      > // current with Crockford's latest code:


      Right. But I don't understand the resistance (or, actually, just lack of any
      feedback at all) to having the kind of solution I described before (in
      another thread) incorporated into the original source code, so that we don't
      have to be going and deleting things like that. Here's what I suggested
      before, which is largely the same as yours, except that mine avoids creation
      where yours utilises deletion and is necessarily separate (and hence a
      little less easily maintained) from the original:

      http://tech.groups.yahoo.com/group/json/message/557

      --
      Martin Cooper


      // after json.js has loaded...
      > // define a namespace to minimize footprint
      > var JSON = {};
      >
      > // add all of the methods
      > JSON.arrayToJSONString = Array.prototype.toJSONString;
      > JSON.booleanToJSONString = Boolean.prototype.toJSONString;
      > JSON.dateToJSONString = Date.prototype.toJSONString;
      > JSON.numberToJSONString = Number.prototype.toJSONString;
      > JSON.objectToJSONString = Object.prototype.toJSONString;
      > JSON.stringToJSONString = String.prototype.toJSONString;
      > JSON.parseJSON = String.prototype.parseJSON;
      >
      > // remove all the methods from intrinsic objects
      > delete(Array.prototype.toJSONString);
      > delete(Boolean.prototype.toJSONString);
      > delete(Date.prototype.toJSONString);
      > delete(Number.prototype.toJSONString);
      > delete(Object.prototype.toJSONString);
      > delete(String.prototype.toJSONString);
      > delete(String.prototype.parseJSON);
      >
      > --- In json@yahoogroups.com, "Martin Cooper" <mfncooper@...> wrote:
      > > Sure - if the for loop is in your own code, and not some other
      > package that
      > > you're just trying to make use of.
      > >
      > > This issue really needs to be fixed in the JSON code, since there's
      > no way
      > > you can rely on it being fixed in all the other code out there that
      > you
      > > might want to use.
      >
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >


      [Non-text portions of this message have been removed]
    • Show all 10 messages in this topic