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.

ECMA-404: The JSON Data Interchange Format [pdf]

255 pointsby dphnxover 11 years ago

27 comments

jcampbell1over 11 years ago
No thanks to Mr. Crawford for not fixing the \u2028-9 issue. JSON as defined is <i>not</i> a subset of javascript. It is a design mistake that was pointed out to him <i>years</i> ago, but he is too stubborn or arrogant to fix it.
评论 #6533685 未加载
评论 #6533835 未加载
Stratoscopeover 11 years ago
Several comments mention the &quot;Software shall be used for Good, not Evil&quot; licensing issue in the JSON code from json.org.<p>The original json.js file from json.org had this copyright and license:<p><pre><code> Copyright (c) 2005 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and&#x2F;or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </code></pre> <a href="http://web.archive.org/web/20060226161035/http://www.json.org/json.js" rel="nofollow">http:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20060226161035&#x2F;http:&#x2F;&#x2F;www.json.or...</a><p>This was a standard MIT license with one change:<p>&quot;This license uses the Expat [MIT] license as a base, but adds a clause mandating: “The Software shall be used for Good, not Evil.” This is a restriction on usage and thus conflicts with freedom 0. The restriction might be unenforcible [sic], but we cannot presume that. Thus, the license is nonfree.&quot;<p><a href="http://www.gnu.org/licenses/license-list.html#JSON" rel="nofollow">http:&#x2F;&#x2F;www.gnu.org&#x2F;licenses&#x2F;license-list.html#JSON</a><p>However, the current versions of json.js and json2.js on GitHub contain only this public domain dedication and disclaimer:<p><pre><code> Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. </code></pre> <a href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;douglascrockford&#x2F;JSON-js&#x2F;blob&#x2F;master&#x2F;json...</a><p>So it&#x27;s no longer an issue. You can feel free to use json2.js for good <i>or</i> evil.
评论 #6534363 未加载
评论 #6535334 未加载
评论 #6534367 未加载
评论 #6534477 未加载
curveshipover 11 years ago
I really (really really) wish they&#x27;d added a way to represent dates. Dates were left out of the original JSON spec since javascript doesn&#x27;t define a syntax for date literals. You have to execute the Date() constructor to make them. Since JSON was supposed to be a subset of <i>non-executing</i> javascript, dates were excluded from JSON.<p>That left serialization to a string as the only way to transfer dates. But since there&#x27;s no specification for the format to use, cross-browser date parsing is a mess (see <a href="http://dygraphs.com/date-formats.html" rel="nofollow">http:&#x2F;&#x2F;dygraphs.com&#x2F;date-formats.html</a> ). JSON + dates = sadness.<p>The non-executing constraint on JSON was a good idea in its early days, when eval was the most common way to parse JSON, but now that there are dedicated parsers for all environments, it&#x27;s not as much a priority. But we&#x27;re still stuck with kludgy workarounds for the lack of native date support in JSON.<p>If there&#x27;s still concern about using the Date constructor, the spec could require that the date be prefixed to avoid execution: &quot;0 || new Date(...)&quot;. Real parsers would extract the date correctly, eval would just return 0.
评论 #6536917 未加载
consultutahover 11 years ago
Hilarious! ECMA-404. My neighbor&#x27;s address is 404 West Whatever Street and I can&#x27;t look at their mailbox without wondering if mail is correctly delivered there...
评论 #6534094 未加载
评论 #6535827 未加载
Jareover 11 years ago
My faint hopes for trailing comma support are now crushed.
评论 #6535358 未加载
评论 #6534263 未加载
评论 #6534042 未加载
评论 #6537677 未加载
评论 #6533672 未加载
basicallydanover 11 years ago
Great stuff. On a side note, this ECMA website is fantastic. I&#x27;ve never seen it before, but it&#x27;s really quite interesting to change the URL to random numbers to find out what other standards ECMA has done.<p>For instance, there&#x27;s a standard for measuring computer equipment in controlled rooms: <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-160.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;files&#x2F;ECMA-ST...</a><p>And here&#x27;s an important one, DVD-RAM discs: <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-330.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;files&#x2F;ECMA-ST...</a> and their cases: <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-331.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;files&#x2F;ECMA-ST...</a><p>Plus, NFC: <a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-340.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ecma-international.org&#x2F;publications&#x2F;files&#x2F;ECMA-ST...</a><p>It&#x27;s all new to me!
JulianMorrisonover 11 years ago
Where this might be important: governments and bureaucracies which have a fondness for formally specified standards. Now they can adopt JSON.
Toucheover 11 years ago
Does this mean we can now use it for evil?
评论 #6534091 未加载
评论 #6534018 未加载
seanconatyover 11 years ago
What&#x27;s so awesome about JSON? Its standard documentation is 5 pages. So simple, so awesome.
评论 #6533865 未加载
评论 #6534088 未加载
oneeyedpigeonover 11 years ago
Why can the solidus (&#x2F;) be escaped?
评论 #6534228 未加载
minor_nitwitover 11 years ago
Excellent standard: Contains not a single example of what actual JSON looks like in text.
penguindevover 11 years ago
&quot;So for example, a string containing only the G clef character (U+1D11E) may be represented as &quot;\uD834\uDD1E&quot;&quot;<p>eww, UTF-16 surrogate pairs. Die, die, die, you scourge. (Yes, I&#x27;ve been working with the win32 api lately, which was designed for UCS2&#x2F;UTF-16).<p>when has 16 bit anything been a good idea, really. TCP port ranges, looking at you too.
评论 #6535673 未加载
rpedelaover 11 years ago
Does this mean comments will be added to the spec?
评论 #6533724 未加载
je_baileyover 11 years ago
Can anyone go into the detail of the impact ,if any, of this?
评论 #6533484 未加载
评论 #6533528 未加载
评论 #6533522 未加载
评论 #6533593 未加载
samatmanover 11 years ago
To summarize the top HN complaints: No date format, no comments, needlessly strict commas.<p>Is it too late for edn? <a href="https://github.com/edn-format/edn" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;edn-format&#x2F;edn</a><p>Symbols that aren&#x27;t &quot;strings&quot; are kinda neat too, and you get downright attached to arbitrary key-value mappings once you have them.
ape4over 11 years ago
They say JSON is not for binary and won&#x27;t change. With a backslash (oops reverse solidus) you could send binary data - eg an image. { myimage: &quot;\01\02\03&quot; } of course, not efficient. You could base64-encode it and put that in a string. I think some syntax for binary would be useful - eg { myimage: 0x010203 }
评论 #6535427 未加载
评论 #6533941 未加载
xioxoxover 11 years ago
No Infinity and NaN :-(
EzGraphsover 11 years ago
Would have been nice if a standard format for hyperlinks were added. This lacks the elegance of pure JavaScript but it would make it possible to create strict RESTful APIs that don&#x27;t violate HATEOAS or includes links as some sort of extension.
chjover 11 years ago
One problem: the standard doesn&#x27;t say whether the names in an object should be UNIQUE.
评论 #6538909 未加载
logician76over 11 years ago
So the standard says a valid JSON text complies to the JSON value grammar. So a valid JSON text can be just one JSON value, like a number or true or false.. however JSON linters always say they expect a { or [ ... who is right?
评论 #6534662 未加载
adam-fover 11 years ago
Figure 5: String, seems to allow actual newlines strings, that&#x27;s not a subset of javascript.
optymizerover 11 years ago
Awesome, now let&#x27;s get JSON Schema standardized so I can use it in production.
appplemacover 11 years ago
404 Standard Not Found
mckossover 11 years ago
Spec not Found? ;-)
eonilover 11 years ago
Why 404.
AsymetricComover 11 years ago
JSON is a great way to make your data accessible to deep packet scanning systems. Define all your protocols with JSON!
评论 #6534120 未加载
ollybeeover 11 years ago
If he want to be formalis JSON e he should use a standard license for the software.<p>I accept &quot;The Software shall be used for Good, not Evil.&quot; is amusing and &quot;good&quot; but must cause difficulties for people wanting to package with other software under standard licenses.
评论 #6533792 未加载