Many people in the blogging community around Lotus Domino have been pushing JSON for a while now. These are mostly user interface oriented people who do a lot more front end web site development than I do. I'm late to the table with this technology, but on investigation it looks like the best workaround to a bad situation I've seen yet.
I want to talk more about JSON in the context of some suggestions for the Domino server rendering useful data. I'll do that in another post, but for now, here's a very quick primer.
As I mentioned in an earlier posting, Web Services work fine for many things, but not the Web itself as rendered in a browser. That's a shame by itself. Web Services move data around in this incredibly hyper-complicated sub class of XML called SOAP that is really on effectively rendered and parsed by standard program code libraries. Doing it yourself is a nightmare of twisty passages, all the same.
JSON (JavaScript Object Notation) is simply a way of passing data to a web page in a serialized notation that is very easy to reconstitute into a javascript object. The hack is that it takes advantage of one of the most flexible aspects of javascript. Javascript can render almost anything -- including itself -- as text very easily. What makes JSON work, is that if you take a javascript object and render it as a text string, you can quickly convert it back to javascript object without losing the characteristics of that object. It is just like "serializing" an object in other languages, only the nature of javascript's un-typed variables makes it much simpler.
A simple object with two properties might be like this:
XML | JSON |
<person> <first name>Andrew</firstname> <last name>Pollack</lastname> </person> | {"person": { "firstname": "Andrew", "lastname": "Pollack"} } |
var person = {"person": { "firstname": "Andrew", "lastname": "Pollack" } } ; alert(person.firstname); |
Comment Entry |
Please wait while your document is saved.