Live data from Hacker News

Why JSON will continue to push XML out of the picture

blog.appfog.com

1–10 of 47 posts

Re: Why JSON will continue to push XML out of the picture

#2
Could someone who knows a lot about these things tell me why JSON took such a long time to arrive?

JSON, at its core, is essentially a hierarchy of maps and lists -- which seems a very intuitive and useful way to store data.

XML on the other hand has always baffled me with its attributes and the redundant and verbose tags (why do I need data?). I'm sure there was a good reason at the time for this, so perhaps someone can enlighten me.

Re: Why JSON will continue to push XML out of the picture

#3

Could someone who knows a lot about these things tell me why JSON took such a long time to arrive? JSON, at its core, is essentially a hierarchy of maps and lists -- which seems a very intuitive and useful way to store data. XML on the other hand has always baffled me with its attributes and the redundant and verbose tags (why do I need data ?). I'm sure there was a good reason at the time for this, so perhaps someon…

I don't know a lot, but:

XML looked like HTML at a time when the web was the "next big thing". Like, not a technology on the web, or social media, HTML itself was this big revelation. So a solution that looks like HTML has a leg up.

Then, once there were mature parsers in a lot of languages, server software configured by it, etc, XML had some inertia that takes time to displace.

Re: Why JSON will continue to push XML out of the picture

#4

Could someone who knows a lot about these things tell me why JSON took such a long time to arrive? JSON, at its core, is essentially a hierarchy of maps and lists -- which seems a very intuitive and useful way to store data. XML on the other hand has always baffled me with its attributes and the redundant and verbose tags (why do I need data ?). I'm sure there was a good reason at the time for this, so perhaps someon…

JSON conceptually has been around forever.

Lisp s-exps date to the original McCarthy paper in 1958, and could represent pretty much everything you can do with JSON, key-value pairs, lists, nested structure, etc.

Re: Why JSON will continue to push XML out of the picture

#6

Could someone who knows a lot about these things tell me why JSON took such a long time to arrive? JSON, at its core, is essentially a hierarchy of maps and lists -- which seems a very intuitive and useful way to store data. XML on the other hand has always baffled me with its attributes and the redundant and verbose tags (why do I need data ?). I'm sure there was a good reason at the time for this, so perhaps someon…

Honestly, JSON isn't really much of an improvement over a technology that's been around since 1958, i.e. s-expressions. JSON is just the flavor of the month - I know people who dislike it because it loses some of the power of XML (XSLT, attributes, etc.)

In the end, I think it's just subjective. All of the above formats are equally capable of representing the same data.

Re: Why JSON will continue to push XML out of the picture

#7
For me the single greatest selling point of JSON is that it's just so danged easy to go from json string to a usable map/list/dictionary in every language. Most of the time you can get from A to B in one or two lines of code.

XML always seemed like such a struggle by comparison. Figuring out which parser(s) you've got installed, figuring out their respective APIs -- it felt like total overkill. The only way I could be productive with XML was using Python's ElementTree API because it was so simple.

Some day I'll need my data to be checked against a complicated schema. But until that day arrives, I'm sticking with JSON.

Re: Why JSON will continue to push XML out of the picture

#8
I think this article has done a great job enumerating trends that show JSON is beating XML for data serialization applications. I think these points are evidence of a shift in thinking, but not the reason for shift itself.

Why JSON over XML? Because people need data serialization format and XML is a Markup Language. JSON is gaining widespread adoption for data serialization applications since it's the correct tool. XML isn't.

In a markup language there is an underlying text that you're annotating with machine readable tags. Most data interchange doesn't have an underlying text -- you can't strip away the tags and expect it to be understandable. If you're writing a web page, that has to be read by humans and interpreted by machines... you need a markup language.

By contrast, data interchange is about moving arbitrary data structures between processes and/or languages. JSON's information model fits this model perfectly: its nested map/list/scalar is simple & powerful. As for typing, it found a sweet spot with text/numeric/boolean.

JSON is the right tool for the data serialization problem.

Re: Why JSON will continue to push XML out of the picture

#9

Could someone who knows a lot about these things tell me why JSON took such a long time to arrive? JSON, at its core, is essentially a hierarchy of maps and lists -- which seems a very intuitive and useful way to store data. XML on the other hand has always baffled me with its attributes and the redundant and verbose tags (why do I need data ?). I'm sure there was a good reason at the time for this, so perhaps someon…

Formats very similar to JSON have been invented many times, for instance NeXT/Apple used to have a human readable format for their plist files that was basically JSON with different characters. http://code.google.com/p/networkpx/wiki/PlistSpec

For some reason they stopped using text plists and replaced it with an ugly xml serialization, but you still see these in Xcode's debugger if you log an NSArray or NSDictionary to the console.

Re: Why JSON will continue to push XML out of the picture

#10
Well-written XML that was designed for humans instead of machines is much, much more easier to read than JSON. The primary reason is that unlike s-expressions or xml, there is no block-name. In JSON you loose valuable time figuring out the block context in a hierarchy since this isn't labelled.

The only kind of JSON that is readable is flat JSON that is nested to a maximum of 1 level.

Post reply on HN