News for hackers. Stuff that matters.
Re:Show HN: JSON5 — modern JSON by drawkbox on Monday May 28, 2012 @12:40AM (#4031959)
JSON is great because it is simple basic cs types (string, numeric, boolean, object, list, date), a perfect middle ground between messaging and readability without going all XML/SOAP. And the unchanging simplicity is that way because it is so broadly accepted from Javascript to web services and beyond. It fits nicely into the system because of it's limitations but that also gives it standardized power.

Any changes to JSON should be fought til death. Use YAML or make a new format if you need more.

Re:Show HN: JSON5 — modern JSON by aseemk on Monday May 28, 2012 @12:50AM (#4031983)
Certainly. I'm not advocating for a change to JSON -- this is explicitly a new format. (The test cases use a .json5 extension to illustrate this.)

FWIW, I'm not adding any new data types or functionality, just making the syntax more human-friendly. It also continues to be a strict subset of ECMAScript, but v5 now.

Re:Show HN: JSON5 — modern JSON by drawkbox on Monday May 28, 2012 @01:50AM (#4032138)
Yes I was just talking in a general sense that JSON should not go all XML and mutate. In some cases I have added layers like this for instance in a C++ parser for game engines it allowed comments in the json but were stripped out at runtime on load and on send/receive from the services. But conforming to JSON that current browsers, libraries etc can use.

I see where you were going with it, ES5 support as a baseline is nice, also comments are nice but also bulky to a streamlined messaging format in most cases (config is usually yaml or some other format for this reason maybe).

I guess the naming is what maybe might cause some confusion and a good engineer makes things more simple not more complex, the simplicity of JSON is hard to achieve with such success but it is also its killer feature so that should be recognized. As long as we don't have to support 50 different 'modern JSON' formats then we are good. There are some good ones like BSON for binary JSON. I guess JSON5 works for your ES5 support.

I think here you have good reasons for your work but it goes back to the age old be 'conservative in what you send, liberal in what you accept'. That standards agreement makes everything work and to me being an engineer is taking complexity and simplifying always, bloat is bad. Here it isn't that but XML started out simple as well and became a verbose, bloated hell so people get touchy with JSON hehe.

Re:Show HN: JSON5 — modern JSON by catch23 on Monday May 28, 2012 @04:07AM (#4032428)
The name is definitely confusing though. You're creating a new format that existing JSON parsers cannot handle. In a way, it's like creating a new XML format called XML2 that uses parenthesis instead of angle brackets, and standard parsers like libxml will no longer be able to read.

Future newbie developers will wonder why their xml reader has problems reading document.xml2 without actually realizing the format is different from xml.

It's worse in your case since JSON5 almost looks like regular JSON, but if one were to use one of your special features, it would cause any normal JSON parser to break. The newbie developer might not be sharp enough to realize he needs a completely different parser.

Re:Show HN: JSON5 — modern JSON by wulczer on Monday May 28, 2012 @08:10AM (#4032976)
JSON does not define a date type.
Re:Show HN: JSON5 — modern JSON by wulczer on Monday May 28, 2012 @08:15AM (#4032983)
Ooops, I might have obsolete information. The grammar on json.org does not define a date type, but ES5 seems to define a Data.prototype.toJSON function. Oh well.