JSON Methods?

Garrett Smith dhtmlkitchen at gmail.com
Thu Sep 6 16:24:53 PDT 2007

> > Well, at least it's not String.prototype.parseDate, that would make
> > even less sense, don't you agree?
> Sure, but only because we have a Date object.  We don't have a JSON
> object, because JSON is not a "thing".
Is that really true?
I think JSON is a definable thing.

JSON - JavaScript Object Notation.

"JSON is a data interchange format which is based on a safe subset of
JavaScript. JSON can represent simple or complex structured data. JSON
cannot represent functions or expressions. It is strictly data. It has
very specific rules of syntax, so it is very straightforward to
determine that a JSON text is syntactically correct. A JSON text can
easily be converted into a JavaScript value, which makes it a very
convenient format for use with JavaScript. There is support for use of
JSON with many other languages, including C#, Java, Perl, PHP, Python,
and Ruby. More information on JSON can be found at www.JSON.org."

FROM: http://www.json.org/JSONRequest.html

String.prototype.parseJSON, Object.prototype.toJSONString are already
in the draft, are they not?

So, I proposed a revision of those two methods in two different classes.

Some other considerations to having a cohesive JSON class:
 * one place where security issues can be managed (there will be more ;)
 * separate JSON object for developers to iterate over (vs for-in for
Object object)
 * doesn't add more methods to String or Object
 * one place to maintain the JSON source code (String, Object)
 * API documentation can be more easily unified (and read)

 * creates a new global symbol in the language

The definitions and discussion about JSON is here:

More information about the Es4-discuss mailing list