TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The I-JSON Message Format

132 pointsby pjvdsabout 10 years ago

10 comments

thom_nicabout 10 years ago
Lack of a native date&#x2F;time format in JSON has been the biggest pain point for me. Most (all?) serializers convert Dates to an ISO string but that almost always requires manual conversion back to a Date during deserialization before doing anything useful with it.<p>Using epoch for dates makes simple math &amp; before&#x2F;after comparison easier but requires explicit conversion during serialization.<p>Unfortunately from what I can tell, I-JSON doesn&#x27;t appear to solve this problem (or does it??) One nice thing about BSON is they made Date types first class citizens of the format.
评论 #9251988 未加载
评论 #9252019 未加载
评论 #9251373 未加载
brianolsonabout 10 years ago
See also RFC 7049 &quot;Concise Binary Object Representation&quot; (CBOR), a &#x27;binary JSON&#x27; <a href="http://tools.ietf.org/html/rfc7049" rel="nofollow">http:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7049</a> <a href="http://cbor.io/" rel="nofollow">http:&#x2F;&#x2F;cbor.io&#x2F;</a><p>Faster, smaller, pretty sure it will parse on the other end.
评论 #9252292 未加载
评论 #9253011 未加载
alexatkeplarabout 10 years ago
It&#x27;s great to see this! We&#x27;ve been bitten by JSON allowing arbitrarily large numbers at Snowplow. This is what a JSON Schema trying to enforce sensible (int64) numeric limits ends up looking like: <a href="https://github.com/snowplow/iglu-central/blob/master/schemas/org.w3/PerformanceTiming/jsonschema/1-0-0" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;snowplow&#x2F;iglu-central&#x2F;blob&#x2F;master&#x2F;schemas...</a>
pjungwirabout 10 years ago
I&#x27;m surprised to see nothing about formatting dates, which in my experience is the worst interop issue with JSON. I&#x27;m glad people are working on this though---thank you!
评论 #9251311 未加载
philsnowabout 10 years ago
If the author of this RFC is still doing edits, I think it might be worth mentioning in section 4.2 &quot;Must-Ignore Policy&quot; something along the lines of,<p><pre><code> An I-JSON implementation supporting a &quot;Must-Ignore&quot; policy SHOULD pass any such new protocol elements on, untouched, to any downstream consumers of the message, because those downstream consumers may understand the new elements. </code></pre> It is another one of those things that are obvious to many people, but I could imagine somebody reading the last sentence of the section, &quot;members whose names are unrecognized MUST be ignored&quot;, and thinking that they should omit the unrecognized elements before passing the message on.
atonseabout 10 years ago
For a lot of the tips (don&#x27;t repeat keys, use ISO8601 dates), most JSON libraries should follow these conventions. So as long as you aren&#x27;t hand-generating your JSON, you&#x27;d need to do very little work to conform to these guidelines.
评论 #9251275 未加载
rdebeasiabout 10 years ago
I&#x27;d love to see someone fork <a href="https://github.com/arc90/jsonlintdotcom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;arc90&#x2F;jsonlintdotcom</a> and add an option for I-JSON validation.<p>[edit] Actually, it looks like the guts of this tool live here: <a href="https://github.com/zaach/jsonlint" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zaach&#x2F;jsonlint</a>
nlyabout 10 years ago
Kind of a bummer that nothing was suggested wrt tightening the number grammar. &quot;99&quot; and &quot;99e0&quot; are both valid serializations of 99, and &quot;0e7&quot; and &quot;0&quot; of zero. JSON also allows arbitrary trailing and leading 0s in the fraction and exponent, respectively. Personally I don&#x27;t know why for instance &quot;0.0&quot; can&#x27;t be the only valid interpretation of a double 0 and &quot;0&quot; be the only valid interpretation of an integer 0. In fact, why can&#x27;t all floats that are ambiguous wrt an integer interpretation have a &quot;.0&quot; tail?<p>Also, if you&#x27;re going to stash binary data in to quoted JSON strings then why base64url encoding and not Z85[0]? It&#x27;s more efficient and easier to decode.<p>Using schema-less formats generally sucks.<p>[0] <a href="http://rfc.zeromq.org/spec:32" rel="nofollow">http:&#x2F;&#x2F;rfc.zeromq.org&#x2F;spec:32</a>
评论 #9253257 未加载
评论 #9252750 未加载
msieabout 10 years ago
To me, I know of Tim Bray because of XML.
评论 #9252091 未加载
twrkitabout 10 years ago
I&#x27;ve run into the date formatting issue that others are mentioning, and just this weekend I discovered the hard way that the V8 JSON parser does not correctly parse the following hierarchy:<p>object --&gt; array --&gt; object --&gt; array<p>I must have spent a few hours trying to figure out why Angular wasn&#x27;t iterating through the first array, only to discover that it was being parsed like so:<p>object --&gt; object --&gt; object --&gt; object
评论 #9251920 未加载
评论 #9251709 未加载