3 ms·
> Seriously, when have you received JSON that you couldn’t immediately parse with your standard JSON parser of preference? Every single time for any non-medioc
by BugsJustFindMe 6y ago
> Seriously, when have you received JSON that you couldn’t immediately parse with your standard JSON parser of preference?
Every single time for any non-mediocre definition of parsing. JSON has no way to transmit the meaning of values, no datetimes, no units, no sets, nor any other semantic attribute. That means your "parsed" result is always useless and wrong on its own, literally a lesser-dimensional projection of the original information, until you interpret it again in an entirely ad-hoc custom manner. Wouldn't it be nice if you could store instructions inline for how to do that.
- nooorofe 6y agoJSON schema exist exactly for that reason, hacks like adding type is just nonsense. If somebody need comments, types it - XML has all that. Also how hard is to write {"type": "datetime", "value": "2021-02-23 12:46:37.07"}?
- BugsJustFindMe 6y ago> JSON schema exist exactly for that reason, hacks like adding type is just nonsense Creating schemas for declaring types is literally a hack for adding type! I think its very bizarre to say "You dont need to do X because you can just do X." > Also how hard is to write {"type": "datetime", "value": "2021-02-23 12:46:37.07"} "datetime" isn't a universal format specification. 2021-01-10 could be October 1 or January 10. What time zone is this in? Local to the sender, UTC, local to the recipient, somewhere else? Is this a 24 hour clock or something that gets a modifier for the other half of the day? You're making some classic mistakes that people make when they don't think about the complexity of the problem domain of communicating information unambiguously.
- nooorofe 6y ago> Creating schemas for declaring types is literally a hack for adding type! It is a "communication protocol" - base of any messaging system. Message has header with protocol name and version: HTTP, TCP, DB connection, SOAP, any message queue - everything working that way. > "datetime" isn't a universal format specification. than use another (see the comment above) self-contained message is anti-pattern