9 ms·
ECMA-404: The JSON Data Interchange Format [pdf]
- consultutah 13y agoHilarious! ECMA-404. My neighbor's address is 404 West Whatever Street and I can't look at their mailbox without wondering if mail is correctly delivered there...
- danabramov 13y ago... Or if maybe they're getting everyone else's misattributed mail.
- walid 13y agoHAHAHAHA! I was scanning the comments hoping that I'd be the first to drop the 404 joke :D I swear the moment I glanced at the title I thought it was an error message that someone accidentally posted.
- je_bailey 13y agoCan anyone go into the detail of the impact ,if any, of this?
- Cthulhu_ 13y agoI'm guessing it may help bring JSON to use in the more restrictive companies that are scared of 'nonstandard' file formats. The kind that currently uses XML for everything.
- octo_t 13y agothe kind that correctly uses XML for everything.
- ensignavenger 13y agoWhy do you believe that using XML is better than JSON in every case? Or am I misinterpreting your comment?
- pfortuny 13y agoDo you know any of these?
- deleted 13y ago[deleted]
- ntkachov 13y agoMore of a formality than anything else. Since JSON was already defined by Javascript, formalizing it doesn't really engrave the standard, it just gives it the recognition that its not just some whacky thing created by Dave.
- Toenex 13y ago"Dave" being recognised as generic name for any developer.
- devonbarrett 13y agoOut of interest, does anyone know the most common first name for a developer?
- l-p 13y agoI'd be interested to know if this has any impact on the "don't be evil" clause in the JSON license.
- postfuturist 13y agoThat's just a license for software available on json.org, so no impact at all.
- jaredmcateer 13y agoWhere is it on json.org? I can't seem to find it.
- postfuturist 13y agojson.org/license
- jaredmcateer 13y agoThanks, I couldn't actually find a link to that page.
- Stratoscope 13y agoThe current versions of json.js and json2.js do not have the "evil" license clause. See my other comment: https://news.ycombinator.com/item?id=6534318 https://news.ycombinator.com/item?id=6534318
- Jare 13y agoMy faint hopes for trailing comma support are now crushed.
- TallGuyShort 13y agoI'm actually very confused by it - I thought the specification for ECMAScript 3 already specified trailing comma support for JSON. Will need to look it up...
- masklinn 13y agoECMAScript 3 did not allow trailing commas in object literals, its section 11.1.5 is: ObjectLiteral : { } { PropertyNameAndValueList } whereas ES5's is: ObjectLiteral : { } { PropertyNameAndValueList } { PropertyNameAndValueList , } And while JSON is strongly inspired by javascript's object notation, it is not actually javascript: their strings are subtly incompatible (JSON allows U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR in quoted strings, javascript does not).
- rpedela 13y agoWhat does trailing comma support get you?
- oneeyedpigeon 13y agoThe ability to be lazy.
- rpedela 13y agoDoesn't seem like a good reason for a spec. Laziness is partly why Javascript as a language is so messed up.
- nilliams 13y agoIf I could down-vote this lazy, drive-by, language bashing I would. Back up 'so messed up' or keep comments like this to yourself, they don't help the discussion.
- Touche 13y agoDoes this mean we can now use it for evil?
- jerf 13y agoThat license issue wasn't about the spec, it was about the implementation. Alas.
- oneeyedpigeon 13y agoNo, only for eval ;-)
- JulianMorrison 13y agoWhere this might be important: governments and bureaucracies which have a fondness for formally specified standards. Now they can adopt JSON.
- jcampbell1 13y agoNo thanks to Mr. Crawford for not fixing the \u2028-9 issue. JSON as defined is not a subset of javascript. It is a design mistake that was pointed out to him years ago, but he is too stubborn or arrogant to fix it.
- baldfat 13y agoWhy do you ask him without the stubborn and arrogant comment on G+ and about trailing commas? Or is indirect better?
- mmahemoff 13y agoProbably because he's very aware of it already and people here may not be. (Meta: Why have any conversation on an HN back-channel when there are comments open at the source?)
- jcampbell1 13y agoTrailing commas would make the problem worse! If you allow trailing commas then you would break json parsing in all old version of IE. The unicode line ending problem is more subtle. I have seen people write code like (mix javascript and some templating): <script> var prefs = <%= user_prefs.to_spec_conforming_json() %>; ... The above code looks okay, but if the json is just spec conforming, then you are exposed to a potential XSS attack. Most people that write json encoders are aware of the problem, but why publish a a spec that can potentially create serious security problems?
- basicallydan 13y agoGreat stuff. On a side note, this ECMA website is fantastic. I've never seen it before, but it's really quite interesting to change the URL to random numbers to find out what other standards ECMA has done. For instance, there's a standard for measuring computer equipment in controlled rooms: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-160.pdf http://www.ecma-international.org/publications/files/ECMA-ST... And here's an important one, DVD-RAM discs: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-330.pdf http://www.ecma-international.org/publications/files/ECMA-ST... and their cases: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-331.pdf http://www.ecma-international.org/publications/files/ECMA-ST... Plus, NFC: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-340.pdf http://www.ecma-international.org/publications/files/ECMA-ST... It's all new to me!
- appplemac 13y ago404 Standard Not Found
- rpedela 13y agoDoes this mean comments will be added to the spec?
- basicallydan 13y agoNope, sorry.
- eliben 13y agoThis sucks, because it limits the usability of JSON. It should interfere with its being a serialization and interchange format, but for configuration files anything without comments is useless.
- jbrooksuk 13y agohttps://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr https://plus.google.com/118095276221607585885/posts/RK8qyGVa...
- rpedela 13y agoCrockford's G+ comment is a pretty dumb reason in my opinion. Just say comments should be completely ignored in the spec. Problem solved.
- swift 13y agoThat's pretty laughable. What exactly prevents people from putting parsing directives in a special object key or list entry at the beginning of the file?
- phpnode 13y agothat would be valid JSON, so it's not a problem. Standard tools can still parse it and reliably turn it into native objects. The same is not at all true when comments exist. People will start putting /* @annotations */ that can only be ready by certain tools which breaks the whole point of JSON - it's a data interchange format.
- ollybee 13y agoIf he want to be formalis JSON e he should use a standard license for the software. I accept "The Software shall be used for Good, not Evil." is amusing and "good" but must cause difficulties for people wanting to package with other software under standard licenses.
- nknighthb 13y agoThat is the license on just one of dozens, perhaps hundreds of JSON implementations. It has nothing at all to do with standardization of the format.
- seanconaty 13y agoWhat's so awesome about JSON? Its standard documentation is 5 pages. So simple, so awesome.
- fleetfox 13y agoIt's not XML
- tel 13y agoXML has its time and place. I'm currently doing medical data processing and I'm really glad it's XML instead of JSON.
- oneeyedpigeon 13y agoAnd a lot of that's fluff (the rails diagrams, boilerplate); you could probably fit it quite comfortably on 1 side of A4 / US letter.
- ape4 13y agoThey say JSON is not for binary and won't change. With a backslash (oops reverse solidus) you could send binary data - eg an image. { myimage: "\01\02\03" } 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 }
- chimeracoder 13y agoThe slash and the solidus are two separate entities. I am not aware of any use of the actual solidus being used for escaping.
- ape4 13y agoI am talking about BACKslash (REVERSE solidus). This says they are the same: http://en.wikipedia.org/wiki/Backslash http://en.wikipedia.org/wiki/Backslash
- chimeracoder 13y agoInteresting. It says they're the same thing, but then the two characters listed on the page (the regular backslash and the Unicode variant) are rendered noticeably differently. I can't imagine why they changed the name, given that the forward slash and the solidus are not interchangeable. http://www.fileformat.info/info/unicode/char/5c/index.htm http://www.fileformat.info/info/unicode/char/5c/index.htm
- nknighthb 13y agoLook at the HTML. The "unicode variant" is rendered differently because the code tells the browser to render it differently, not because it's a different character. <span style="font-size:125%"><span class="Unicode">\</span></span>
- chimeracoder 13y agoAh, thanks. I was on my phone and didn't think to check the source. EDIT: Actually, this explanation is enlightening: http://en.wikipedia.org/wiki/Slash_(punctuation)#Encoding http://en.wikipedia.org/wiki/Slash_(punctuation)#Encoding
- AsymetricCom 13y agoJSON is a great way to make your data accessible to deep packet scanning systems. Define all your protocols with JSON!
- danabramov 13y agoYou may as well make this argument against human speech. We need secure transport, not gibberish protocols.
- AsymetricCom 13y agoNot really even a close metaphor, since human speech isn't a internet standard I could build devices against and sell to customers as compliant. Considering that DPI devices are already sold to parse json-desribed protocols dynamically, I think you are a bit uninformed about my statement. It is not hypothetical.
- icebraining 13y agoSome DPI software also processes English, should we stop using it? If you want security, you need encryption, not obscure encoding formats.
- oneeyedpigeon 13y agoWhy can the solidus (/) be escaped?
- oneeyedpigeon 13y agoOh, god - apparently, it's to support IE5.5 and to allow "</script>" to be embedded in a "<script></script>" pair and not be interpreted as closing the script. I wish I hadn't asked, and I wish I hadn't then gone and found out ...
- alternize 13y agothanks. was wondering the same...
- adam-f 13y agoFigure 5: String, seems to allow actual newlines strings, that's not a subset of javascript.
- Stratoscope 13y agoSeveral comments mention the "Software shall be used for Good, not Evil" licensing issue in the JSON code from json.org. The original json.js file from json.org had this copyright and license: 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 "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/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 "AS IS", 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. http://web.archive.org/web/20060226161035/http://www.json.org/json.js http://web.archive.org/web/20060226161035/http://www.json.or... This was a standard MIT license with one change: "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." http://www.gnu.org/licenses/license-list.html#JSON http://www.gnu.org/licenses/license-list.html#JSON However, the current versions of json.js and json2.js on GitHub contain only this public domain dedication and disclaimer: Public Domain. NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. https://github.com/douglascrockford/JSON-js/blob/master/json2.js https://github.com/douglascrockford/JSON-js/blob/master/json... So it's no longer an issue. You can feel free to use json2.js for good or evil.
- tedivm 13y agoYou mean Douglas Crockford broke down and gave into the "pro-evil fanatics"? For context, after Mr. Crockford gave IBM permission to use the license without the clause a few open source projects (mine included), also asked, and Mr. Crockford's response was a bit over the top- > I released to free use for all with the only condition that it not be used for evil. If that is unacceptable to you, then you may not use it. Your options are to bend to the pro-evil fanatics, or to find a more reasonable hosting solution. It's nice to see he's become a bit more reasonable.
- eonil 13y agoWhy 404.
- logician76 13y agoSo 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?
- logician76 13y agohttp://jsonlint.com/ http://jsonlint.com/ expects [ or { first. http://zaach.github.io/jsonlint/ http://zaach.github.io/jsonlint/ does not and seems to comply to the standard as I interpret it.
- xioxox 13y agoNo Infinity and NaN :-(
- EzGraphs 13y agoWould 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't violate HATEOAS or includes links as some sort of extension.
- penguindev 13y ago"So for example, a string containing only the G clef character (U+1D11E) may be represented as "\uD834\uDD1E"" eww, UTF-16 surrogate pairs. Die, die, die, you scourge. (Yes, I've been working with the win32 api lately, which was designed for UCS2/UTF-16). when has 16 bit anything been a good idea, really. TCP port ranges, looking at you too.
- quink 13y agoChar can be anything not " or \. You don't have to escape unicode. If you want to just use Unicode and encode as UTF-8 then go nuts. This is valid JSON: { "äöü": "大家好", "clef": "𝄞" }
- penguindev 13y agoI realize that. I'm just sad to see UTF-16 vestiges living on, in current specs. Who can fathom how much misery and billions of dollars in wasted productivity (byte order marks - fun!) that wrought upon the IT landscape.... Python has an upper case \UXXXXXXXX literal that seems a lot cleaner.
- deleted 13y ago[deleted]
- mckoss 13y agoSpec not Found? ;-)
- optymizer 13y agoAwesome, now let's get JSON Schema standardized so I can use it in production.
- curveship 13y agoI really (really really) wish they'd added a way to represent dates. Dates were left out of the original JSON spec since javascript doesn'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 non-executing javascript, dates were excluded from JSON. That left serialization to a string as the only way to transfer dates. But since there's no specification for the format to use, cross-browser date parsing is a mess (see http://dygraphs.com/date-formats.html http://dygraphs.com/date-formats.html ). JSON + dates = sadness. 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's not as much a priority. But we're still stuck with kludgy workarounds for the lack of native date support in JSON. If there's still concern about using the Date constructor, the spec could require that the date be prefixed to avoid execution: "0 || new Date(...)". Real parsers would extract the date correctly, eval would just return 0.
- TazeTSchnitzel 13y ago>But since there's no specification for the format to use, cross-browser date parsing is a mess Wrong! Since ECMAScript 5 there is a single, standard format that all browsers will try to parse first and can predictably output: ISO 8601. -- [02:49:29.621] (new Date()).toISOString() [02:49:29.623] "2013-10-12T01:49:29.623Z" -- [02:49:40.233] JSON.stringify(new Date()) [02:49:40.245] ""2013-10-12T01:49:40.246Z""
- curveship 13y agoNo, not all browsers, and not all of ISO 8601. Safari only added ISO 8601 Zulu parsing in the last few months, and IE only at version 9. Neither support explicit timezones yet. Which means there's still a large population of browsers that will choke. As I said, date parsing is a mess. In any case, my general point still stands: dates are the only "data" type (i.e. not a function, regex, etc.) which is not supported by JSON. So even if there were a usable universal serialization format, you'd still need to post-process the results of the JSON parser to convert the strings into dates.
- samatman 13y agoTo summarize the top HN complaints: No date format, no comments, needlessly strict commas. Is it too late for edn? https://github.com/edn-format/edn https://github.com/edn-format/edn Symbols that aren't "strings" are kinda neat too, and you get downright attached to arbitrary key-value mappings once you have them.
- minor_nitwit 13y agoExcellent standard: Contains not a single example of what actual JSON looks like in text.
- chj 13y agoOne problem: the standard doesn't say whether the names in an object should be UNIQUE.
- jaredmcateer 13y agoJSON is a subset of JavaScript (a few bugs notwithstanding) so you must conform to it's spec and then JSON adds further restrictions on the language in it's spec.
- SusanLTomlin 13y agomy neighbor's step-sister makes $67 hourly on the computer. She has been unemployed for nine months but last month her paycheck was $15744 just working on the computer for a few hours. try this site ====================================================== http://WWW.Works23.Com http://WWW.Works23.Com