←back to thread

Fixing JSON

(www.tbray.org)
139 points robin_reala | 2 comments | | HN request time: 1.04s | source
Show context
_greim_ ◴[] No.12327784[source]
With the exception of trailing commas, all these things would break the fact that JSON is a subset of JavaScript. Breaking that would cause a lot more problems than it solves. It's just that the minor problems you have to live with seem worse than the major problems you don't.
replies(1): >>12327801 #
wtetzner ◴[] No.12327801[source]
What value is there in having JSON be a subset of JavaScript? In fact, it would be a good idea to make it not be a subset of JS, because that would prevent people from evaling it.
replies(6): >>12327847 #>>12327856 #>>12327894 #>>12327900 #>>12327926 #>>12328431 #
1. doppel ◴[] No.12327847[source]
Most major browsers now support non-eval JSON parsing that it's a moot point - but it still requires it to be valid JSON, also be be usable in javascript out of the box.

JSON has the same thing going for it as the h.264 video codec - it may not be _the_ best/most open/etc. format around, but it is one of the few that is supported out the box by all major browsers and Just Works™ (with it's shortcomings).

replies(1): >>12327858 #
2. wtetzner ◴[] No.12327858[source]
Sure, but there's a difference between "we shouldn't break an existing format" and "it has to be a subset of JavaScript".