Monday, May 9th, 2005

Ajax Summit: Douglas Crockford of JSON Presentation

Category: Ajax

Douglas Crockford is well known for JSON.org, “The fat-free alternative to XML”. He “discovered” JSON, which Doug explains is a “Data Interchange” format, versus a document format.

Being Well Formed and Valid, doesn’t mean “Relevant and Correct”, so Douglas focuses on the sender and the receiver, and semantic knowledge between them.

This presentation was the first time that I heard “A9’d” instead of the more common “Google’d” :)

Douglas’ first use of JSON was at Veil networks, which was building an alternative for page replacement.

The model used items such as:

<script>
parent.veil.receive(
{ “to”: “thing_42”,
“op”: “change”, …},
…);
</script>

I think that people are trying to work out what the sweet spot is for JSON. We don’t want to get into distributed object hell when we end up sending huge amounts of “objects” between the browser “client side” and the server side “real objects”.

Having widgets that grok JSON *and* XML could be an answer.

eval() is a nicer parser than an xmljs lib.

Posted by Dion Almaer at 2:31 pm
5 Comments

+++--
3 rating from 5 votes

5 Comments »

Comments feed

JSON is really a best-of-all-worlds deal when used in Ajax apps. I’ve recently been putting it to the test in a real-world application. Sending and receiving eval-parseable data packets sidesteps the major headaches of XML parsing in Javascript. As far as I can tell, the other two options for data returned from XMLHttpRequest calls — raw javascript statements and XML — each have problems. Raw javascript makes it necessary for the server to know a little too much about the client-side, while XML is just a gigantic freaking hassle to parse in JS.

I’ve got a PHP implementation going at http://mike.teczno.com/json.html for users of that language.

And… where does one find out about the Ajax Summit? I feel like my usual information supply lines failed me, or something. :)

Comment by Michal Migurski — May 9, 2005

“distributed object hell”

In JSON bear in mind that an “object” is simply a map (Java), i.e. dictionary (Python). This is not the same issue as calling methods on distributed objects, as in CORBA, Java RMI, C# remoting, etc. JSON “objects” are data structures sent by value. There is no lingering connection to a remote object. So there is no hell, just heaven.

JSON objects are a simple sweet spot for elements and values in XML. They are no more “distributed objects” than is an XML document.

Comment by Patrick Logan — May 10, 2005

JSON constitutes an object map and/or primitive nicely under certain circumstances. Can I serialize a js Date object yet?

Comment by Jim Cook — May 10, 2005

My understanding of JSON based on a few emails with Douglas (I wrote json-py, https://sourceforge.net/projects/json-py) is that the core of JSON will stay close to its current definition. However as in object-oriented programming, one can create new objects using the core.

I interpret that to mean conventions will emerge (and the JSON community should help the conventions converge). And so date/time, currency, complex numbers, etc. can be defined as conventions of usage.

I created a date/time convention for my own benefit with an object whose keys are “year”, “month”, “day”, etc.

Comment by Patrick Logan — May 10, 2005

Doug Crockford has rejoined his Communities.com and Veil Networks cofounders at Yahoo! His work will be AJAX/JSON related.

Randy

Comment by F. Randall Farmer — August 12, 2005

Leave a comment

You must be logged in to post a comment.