Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think one of the mistakes this article makes is believing that people know what they want upfront. We all know that people are very poor judges of what could and couldn't be useful to them before you actually give it to them.

OpenID should probably have seen it was overly complex, but I'm not sure how anyone could have guessed that XML was going to be shunned in favor of JSON. It does have some pretty cool advantages, such as DTDs ensuring correctness. It's just that it got a lot of typing real fast (and probably was never supposed to be written by humans anyway) and the space sizes blew up too.



From personal experience I think the reason JSON won over XML is simply because it maps to OOP/dictionaries much better.

In most scripting languages reading JSON looks like this: x = json.parse(string) and saving it looks like this string = json.dump(x) ... The rest of the app looks the same as if JSON was never in the picture at all.

Now with XML, hah, in most scripting languages you have to instantiate a parser, then use strange xpath traversal methods that are different depending on which parser you use and os on. And don't even get me started on generating xml programmatically ...

Sure, I understand why handling XML has to be so much more complex, it's got attributes and a few other nifty things I will never have a use for.

JSON vs XML --> simplicity always wins over more features.


JSON won because there's a straightforward mapping between a JSON document and the language's native arrays, maps and values.

The remainder of the problems you list are not problems. There are one line parse and dump functions for XML. You don't need to use xpath to traverse a document. The result of parsing a document is the same across each OS (at least in Python, Ruby, Java, Go and other languages that I have used). An application shouldn't need to use more than one parse, so it does not matter that different parsers represent the DOM differently.


Back in the beginning some people did make the obvious observation that XML wasn't a good idea for data given that it was designed for documents. It's just taking a decade to roll back the excess hype.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: