__proto__ and JSON

Brendan Eich brendan at mozilla.com
Wed May 30 06:52:36 PDT 2012

Felix Böhm wrote:
> Okay, fair point. But JSON.parse should do what it's name says: Parse 
> JSON. Ignoring keys is not an option.
JSON.parse must not treat __proto__ specially, per ES5. What's the 
problem you see?

> Having __proto__ as a setter would make much more sense for me, too. 
> No magic involved, just some functionality I don't need to care about.

Please see the thread on "Re: Subclassing built-in constructors", also 
the meeting notes followups from me. __proto__ has a hidden setter, it 
masquerades as a data property to avoid leaking a set-[[Prototype]] 
capability that would require extra checking and could (based on long 
and hard experience) lead to mischief.

The de-facto and soon to be de-jure Object.prototype.__proto__ standard 
has no bearing on ES5's JSON.parse, which continues unchanged per the 
JSON RFC (I trust -- tell me if you see a bug).


More information about the es-discuss mailing list