Wednesday, December 20, 2006

Re: God bless the re-inventers

Dave asks why JSON re-invented the wheel: "I read on Niall Kennedy that has come up with an API that returns a JSON structure, and I figured, sheez it can’t be that hard to parse, so let’s see what it looks like, and damn, IT’S NOT EVEN XML!"

Dave, web browser capabilities pragmatically drove JSON's Javascript-like format. Unlike XML-based protocols, you can use a JSON service across different web sites with existing browsers (without a server side proxy, Flash, etc.).

I suppose you could base the protocol on XML if you really wanted to, but you'd still have to provide a Javascript wrapper. Fewer browsers support natively parsing XML than Javascript, and performance would suffer. We do all have Ghz machines nowadays, but today's browsers seem to need that and more; I can't believe Firefox still manages to hang for seconds at a time on my Mac Pro.

Sites often offer JSON APIs in addition to XML APIs to support pure browser-based usages. has had an XML API for a long time; they use RSS! If I were calling an API from Java, I'd use the XML not the JSON API.

That said, I'm personally not a fan of the current JSON spec. If you structure your Javascript like the following example, you can support complex graphs, circular references, etc., whereas the current spec. only supports hierarchies: a={};b={};c='foo';'c';a.bee=b;b.ay=a;


Blogger Jesse Kuhnert said...

Let's not forget that unlike the rest of our sometimes bloated software worlds the line of communication between browser -> client is not the kind of forgiving protocol that you can just cram as much down the wire as you'd least if you are trying to create a response public facing web site.

3:21 PM  
Anonymous Anonymous said...

Improvements also continue to be made in the automated processes used to
develop pictures and have lead to the availability of one-hour photo
processing facilities. The real future of photography may lie in the area
of digital imagery,

4:19 AM  

Post a Comment

<< Home