←back to thread

Fixing JSON

(www.tbray.org)
139 points robin_reala | 1 comments | | HN request time: 0.369s | source
Show context
mschuster91 ◴[] No.12328280[source]
I don't agree with the "timestamps" part, for several reasons:

1) the author does not mention in his example the use of timezone offsets (which are a part of RFC3339), that's a bit irritating

2) Timestamp parsing and emitting sucks, no matter the language, because the format specifiers are wildly inconsistent across platforms. I prefer the good old UNIX timestamp, because with it there's no complex massaging needed in order to operate with the timestamp.

Also, the author is missing comments entirely - no matter if shorthand // or long-form /* */ gets included, JSON desperately needs commenting ability; but on the other hand I'm worried about compatibility with older systems...

replies(1): >>12329879 #
1. pluma ◴[] No.12329879[source]
1) The author does. Z means UTC.

2) The JS Date type has a "toISOString" function that emits an ISO date time string like the ones used in the examples. Since everything else is already based on what JS does, why not just move that behaviour into the JSON spec as well?