One thing I realized today and I thought it would make sense to follow up on this for completeness.:
ECMAScript 5 spec [1] says the following in chapter "16 Errors":
"An implementation must report most errors at the time the relevant ECMAScript language construct is evaluated. An early error is an error that can be detected and reported prior to the evaluation of any construct in the Program containing the error. [...]
An implementation must treat any instance of the following kinds of errors as an early error:
[...]
- Attempts in strict mode code to define an ObjectLiteral that has multiple data property assignments with the same name.
[...]
"
What the "Program" means in this context is defined (I think) in the same spec starting from "5.1.4 The Syntactic Grammar" followed by chapter "5.1.5 The JSON Grammar" stating that:
"The JSON grammar is used to translate a String describing a set of ECMAScript objects into actual objects. [...]"
So to me it seems that JSON grammar in strict mode should not allow for "multiple data property assignments with the same name". In other words, I think the peg.js JSON grammar example [2] should state that it is not ECMAScript 5 "strict mode" compliant :-)
Regards,
Lukáš