Re:JSON5 – JSON for Humans
by stickfigure on Sunday December 08, 2024 @06:47PM
(#42361776)
Still no timestamps :-(
[ Parent
| on HN ]
What's wrong with Unix? Or is the complaint that there's no data type for time stamps specifically?
I agree it would be nice to have something with more data types. Binary b64/hex would be nice.
> What's wrong with Unix?
When you read 847548, is that a number or is that Saturday, 10 January 1970?
Having a type removes that ambiguity. It would be more JSONish for it to be human readable, maybe @1970-01-10T19:25:48.
Or maybe extend this with types for the timestamp, `@ms:1623132000` or `@unix:1623132000`, so in a value: `{"now":@unix:1623132000}`
Mongo types the field name, `{"$date":1623132000}`, if I'm not mistaken. Rust style would be `1623132000_unix`.
Or with anticipation of a more full typing system, where the time is explicitly named:
`{"now": unix:1623132000}`
For now, when I need typing, I use https://json-schema.org
Yeah. But I think the goal was here to sugar the syntax while keeping semantics intact.
Re:JSON5 – JSON for Humans
by Dylan16807 on Sunday December 08, 2024 @09:22PM
(#42362551)
For a basic timestamp use a number.
If you need more, you enter territory that is much too complex to build into the "simplest data format" spec.