4 ms·
The problem comes from the fact that JSON is explicitly defined in terms of JavaScript, and as a strict subset of JavaScript. You could add comments without muc
by Millennium 14y ago
The problem comes from the fact that JSON is explicitly defined in terms of JavaScript, and as a strict subset of JavaScript. You could add comments without much trouble, because JavaScript has comments. But JavaScript has no date literal, so neither does JSON, and adding one becomes problematic. You'd have to either decouple JSON from JavaScript, or you'd have to convince the ECMAScript folks to adopt a date literal syntax.
It could be argued that decoupling JSON from JavaScript might be a good idea. It would force developers to stop parsing JSON as JavaScript (through eval() or script tags), and this alone would eliminate whole classes of bugs. But the logistics would be nothing short of nightmarish.