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

871Re: json.js

Expand Messages
  • Julian Tonti-Filippini
    Oct 3, 2007
    • 0 Attachment
      I wanted to modify json.js to add RegExp support so I added the following:

      RegExp.prototype.toJSONString = function () {
      return this.toString().toJSONString();
      };

      ...and found that it didn't work under Firefox because the typeof
      RegExp is 'function' rather than 'object'. This required modification
      of the switch in Object.prototype.toJSONString to add a fall-through
      case for 'function'.

      My gut tells me that there's something criminally wrong about does
      this. Can someone tell me why?

      - Julian
    • Show all 13 messages in this topic