3 ms·
Why don't we just change the JSON spec to include ISO 8601 date, time, timestamp, and comments?
by rpedela 14y ago
Why don't we just change the JSON spec to include ISO 8601 date, time, timestamp, and comments?
- Millennium 14y agoThe 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.