Last Comment Bug 340987 - Implement JSON extensions to the JS language.
: Implement JSON extensions to the JS language.
Status: RESOLVED DUPLICATE of bug 408838
: perf
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- normal with 19 votes (vote)
: ---
Assigned To: general
:
: Jason Orendorff [:jorendorff]
Mentors:
http://wiki.ecmascript.org/doku.php?i...
Depends on: 387522
Blocks: 385349 386789 js1.8.5 es5
  Show dependency treegraph
 
Reported: 2006-06-09 10:37 PDT by Erik Arvidsson
Modified: 2009-05-09 13:26 PDT (History)
39 users (show)
mtschrep: blocking1.9-
mtschrep: wanted1.9+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Erik Arvidsson 2006-06-09 10:37:17 PDT
Implement JSON methods on JS objects.

This is planned for JS2.0 but I don't see a reason why it should not be added to JS1.x

As far as I remember these new methods are:

String.prototype.parseJSON
Object.prototype.toJSONString

Sub classes of Object needs to override this.

Array.prototype.toJSONString
String.prototype.toJSONString

Other built in classes can use toString
Comment 1 Jesse Ruderman 2006-06-09 19:14:10 PDT
Interesting.  I'm guessing these differ from eval/uneval by refusing to eval or uneval functions, for example?
Comment 2 Brendan Eich [:brendan] 2006-06-17 20:05:29 PDT
This is still being discussed for ES4, it won't make JS1.7.

/be
Comment 3 Brendan Eich [:brendan] 2006-10-06 11:04:49 PDT
This might be good to do in Mozilla 1.9/Firefox 3, but then we're on the slippery slope to a JS1.8...

/be
Comment 4 Carsten Book [:Tomcat] 2006-11-28 12:10:06 PST
*** Bug 360666 has been marked as a duplicate of this bug. ***
Comment 5 nrlz 2007-03-07 17:30:18 PST
The JSON syntax allows arrays to be the root object. There has been an article on Ajaxian <http://ajaxian.com/archives/the-safety-of-json> that describes a way of stealing cross-domain JSON data (if the JSON is an array) by overriding the Array constructor, then pulling in the JSON with a cross-domain script tag and then capturing the generated array before it goes away. Is it possible to mitigate this attack?
Comment 6 Jesse Ruderman 2007-05-17 19:17:08 PDT
nrlz, see bug 376957, "Prevent data leaks from cross-site JSON loads".
Comment 7 John Resig 2007-12-28 09:25:00 PST
Now that Native JSON Support (bug 387522) has landed, can we set this to be on track with FF3b3? Like that ticket, getting this to land would be a huge performance win - perhaps more so, considering that this would effect thousands of web applications directly.
Comment 8 Mark Finkle (:mfinkle) (use needinfo?) 2008-01-05 16:32:00 PST
I am wondering if bug 408838 better serves John's needs for exposing native JSON to web content.
Comment 9 Mike Schroepfer 2008-01-18 12:30:58 PST
I'd love this personally, but time is running short for FF3 and we are way beyond new feature type stuff.  If we can get a low-risk version in great - but we will not hold the release for this.
Comment 10 John Resig 2008-04-17 09:01:14 PDT
Bumping to JS1.9.
Comment 11 Brendan Eich [:brendan] 2009-05-09 13:03:35 PDT
Is this a pure DUP?

/be
Comment 12 Robert Sayre 2009-05-09 13:26:08 PDT

*** This bug has been marked as a duplicate of bug 408838 ***

Note You need to log in before you can comment on or make changes to this bug.