Andrew: As magicmonkey says, I ripped out all the extra bits and bobs to make these examples more readable. I think the point about using JSON as a transport is a very valid one though, many languages now have built-in support for working with JSON objects so this would be a valid choice.

magicmonkey: hey there, thanks for dropping in, you are exactly right about my having removed code to try to keep the examples to the point :)