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.

No comments: