3 ms·
I'm actually very confused by it - I thought the specification for ECMAScript 3 already specified trailing comma support for JSON. Will need to look it up...
by TallGuyShort 13y ago
I'm actually very confused by it - I thought the specification for ECMAScript 3 already specified trailing comma support for JSON. Will need to look it up...
- masklinn 13y agoECMAScript 3 did not allow trailing commas in object literals, its section 11.1.5 is: ObjectLiteral : { } { PropertyNameAndValueList } whereas ES5's is: ObjectLiteral : { } { PropertyNameAndValueList } { PropertyNameAndValueList , } And while JSON is strongly inspired by javascript's object notation, it is not actually javascript: their strings are subtly incompatible (JSON allows U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in quoted strings, javascript does not).