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 printingworld said...

best site

4:11 AM  
Anonymous Mental Health said...

developments include an increased understanding of the brain's function
through the study of neuroscience, the development of effective new
medications and therapies, and the standardization of diagnostic codes
for mental illnesses

4:14 AM  
Anonymous Online Casino said...

online casinos offer signup bonuses to new players making their first deposit.
These bonuses normally match a percentage of the player's deposit with a dollar
maximum, and almost all online casino signup bonuses require a minimum amount
of wagering before allowing a cash out

4:16 AM  
Anonymous Tutorials said...

An instructional book or program that takes the user through a prescribed
sequence of steps in order to learn a product. Contrast with documentation,
which, although instructional,

4:17 AM  
Anonymous photographs 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

Links to this post:

Create a Link

<< Home