Live data from Hacker News

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

ecma-international.org

161–170 of 199 posts

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

#162

I 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…

>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""

No, 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.

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

#163

Earlier quoted context omitted.

Don't use JSONP.

I suppose you have a better way to do cross-platform cross-domain APIs? Enlighten us. Facebook and Google use this method, and I assume it is because there isn't a better way.

You can use CORS [1] on browsers that support it. [2] You really should use it if at all possible given your application's constraints, so you don't have to abuse GET requests and can use a JSON parser.

[1] http://en.m.wikipedia.org/wiki/Cross-origin_resource_sharing

[2] http://caniuse.com/cors

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

#164
post #109

Earlier quoted context omitted.

because that is what json is for

no, that's not what json for. JSON is for exchange data between machines. We already have data interchange formats for humans, we call those 'languages'.

It must be nice to live in a world in which you never have to read JSON. Or, for that matter, any other format which is used to exchange data between machines - binary included. Worse, sometimes even XML.

I should like to visit that world one day.

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

#165

Earlier quoted context omitted.

Yeah, people trying to comply with laws are just hilarious. Sigh.

You can't please everybody (particularly when you are having a laugh at somebody's expense.)

That was a million dollar laugh.

Yes, a million dollars.

We have testimony in this very thread from tedivm who had to rewrite JSMin because of this laugh. That has to have been a multi-thousand-dollar project right there.

Think about the time IBM alone spent on this issue. Developers, managers, lawyers. Five grand? Easily. Maybe more.

Play out this scenario a few hundred times across the globe, and there's your million dollars.

The problem is, when you have a laugh at somebody's expense, it isn't free. It comes at somebody's expense.

And ultimately the laugh wasn't worth a penny, because the license was finally changed to a true open source (public domain) license.

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

#166

Earlier quoted context omitted.

I suppose you have a better way to do cross-platform cross-domain APIs? Enlighten us. Facebook and Google use this method, and I assume it is because there isn't a better way.

You can use CORS [1] on browsers that support it. [2] You really should use it if at all possible given your application's constraints, so you don't have to abuse GET requests and can use a JSON parser. [1] http://en.m.wikipedia.org/wiki/Cross-origin_resource_sharing [2] http://caniuse.com/cors

Cross platform?

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

#167

What's so awesome about JSON? Its standard documentation is 5 pages. So simple, so awesome.

It's not XML

XML has its time and place. I'm currently doing medical data processing and I'm really glad it's XML instead of JSON.

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

#168

Earlier quoted context omitted.

Don't they have another browser around for dealing with the rest of the world though? It's not like many modern sites are going to render correctly on IE6 these days...

But all their apps work with IE6, and who cares about people trying to view Facebook while working?

If they are off in their own totally isolated little IE6 only world, I don't get why we care about them then.

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

#169

Earlier quoted context omitted.

You can't please everybody (particularly when you are having a laugh at somebody's expense.)

That was a million dollar laugh. Yes, a million dollars. We have testimony in this very thread from tedivm who had to rewrite JSMin because of this laugh. That has to have been a multi-thousand-dollar project right there. Think about the time IBM alone spent on this issue. Developers, managers, lawyers. Five grand? Easily. Maybe more. Play out this scenario a few hundred times across the globe, and there's your milli…

> It comes at somebody's expense.

Bullshit. You are not entitled to any particular piece of software, not a single thing is taken from you when you find a software license intolerable. So something isn't licensed how you like... so what? Negotiate new terms, or move on with your life and use something else.

Bitching that something is 'Do no evil' licensed so that you cannot use it is no better than bitching that something is GPLv3'd so you cannot use it, or something is only licensed under proprietary licenses so you cannot use it.

People getting upset over licenses that render software unenjoyable to themselves is the sort of entitled bullshit that makes me want to seek out the most obnoxious license possible. Somebody should make a AGPLv3/Do no Evil hybrid license and write some mildly useful piece of software to use it for, then refuse to duel-license for any earthly fee. That should make some people squirm.

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

#170

Earlier quoted context omitted.

> you would break json parsing in all old version of IE Why do people still care about old versions of IE?

~22% of China still uses IE6: http://www.ie6countdown.com/ Developing nations have a tendency to not use the latest and greatest. If reaching them is important for you/your product then you have to keep tracking this stuff.

And if the internet stops working for them because they use IE6, will they somehow manage to upgrade?
Post reply on HN