Sunday, October 25, 2009

JSON vs XML

Following up on my previous post, I explored XML vs JSON for exposing Domino data.

In order to evaluate both the formats, i set out to build a small component to achieve the following: "Read all names/emails from Domino address book and implement AJAX to optimize name search".

I defined the critical success factors to be a) Performance b) Ease of use.

I am yet to complete the development of my test component, but based on initial findings I bet on JSON to be my preferred mode.

Here is why:

Performance: Given below is the time taken for exposing a domino address book (with over 140,000 entries) (Using Firebug 1.4)

In JSON format:


In XML format:


Clearly domino renders data in JSON format much quicker.

Ease of use: JSON data is as good as any other Javascript object. Hardly any learning curve for using JSON output.

Caveat:
Be aware of possibility of malicious cross-site scripting on JSON output. Need to be judicious before using javascript 'eval()' on JSON output.

JSONView:
For all JSON enthusiasts, JSONView (current version 0.4) is a nice firefox addon to render JSON outout on the browser itself.

Exposing Lotus domino data to external systems

As a part of project work, I have been exploring alternate ways of exposing data from a Lotus Domino system.

Since Lotus Domino release 4.5, Domino comes with an inbuilt web-server and can respond to http requests with notes data from .nsf file. However this approach tightly binds data with the presentation layer, hence is not really efficient.

Starting Domino release 5.0.2, it adopted XML as the standard data exchange format and provided services (i.e http://server/notes db path/view name?Readviewentries..) to expose domino data in XML format for external systems to read and and present as they like.

With Domino Release 7.0.2, domino extended its services to expose Lotus notes data in JSON format. Without adding any complexity, you can simply specify that output format as JSON from the Readviewentries service. i.e .. extending the example in the previous section, you can get JSON format by calling this url..
http://servername/notes db path/view name?Readviewentries&outputformat=JSON..

In future posts i would evaluate Domino's XML vs JSON services..