Monday, July 07, 2008

JSON and JsonML

JSON (JavaScript Object Notation) is a data interchange format for transferring data between disparate systems. Unlike XML (which is also designed for this), it is far simpler and can be processed more easily by client applications (no validation, or other advanced features of XML) and easier to implement (no special parser needed like XML) - JSON: The Fat-Free Alternative to XML. There are examples of JSON messages (and the XML equivalent) on the JSON Example page. You can validate JSON online using JSONLint.

While its name suggests that it is only for programmers using JavaScript, it is useful for other programming languages as well. The JSON site lists implementations and even hosts code for several languages, e.g. JavaScript, C and Java.

JsonML is a way of transporting XML data by representing it in the JSON syntax. As a result, it can be be used for transmitting XHTML markup (represented as JSON rather than XHTML) which can then be added directly to the document (via the DOM, instead of innerHTML). For jQuery developers, there is a plugin for working with JsonML: JSONML Array to DOM -

No comments: