Although these two are great in themselves, there is an ongoing debate on what works best with JavaScript to create RIAs. XML have been around with Ajax since it was conceptualized (that’s why the name Ajax). As a general mark-up tool, it can easily adapt to JavaScript. However, JSON has gathered enough developers to support it that it has now been considered by budding developers.
So what is the difference between JSON and XML? Let’s take a look at the basic facts about them and see what could be used in JavaScript.
Why JSON?
Essentially JSON is built for Data Structuring. When you take a look at it, JSON takes care of the Data Architecture of the Ajax based program. It has been widely accepted because it caters to the general need of Ajax. When you take a look at it, Ajax is a very broad program that needs to be harnessed. JSON is very easy to configure and it generally answers the need of every programmer. Compared to XML, JSON is also shorter to configure. In XML you could go as far as 7000 lines and could only go 75% of the data configuration. However, for JSON you can actually reduce it to a mere 1,500 lines. That’s far easier and controllable. Debugging is also easy and as far as any developer is concerned, a thousand lines could even be manually checked.
Why XML?
As we have noted, XML takes the longer route in developing the specific program. The reason for this is that XML is more concerned with the specifics of the program compared to JSON. Besides XML is a general purpose program so you have to configure it for JavaScript. The great thing about this program is that it gives you more freehand expression in your Application. Some see it as XML’s disadvantage but the way I see it, XML’s longer version of coding is a good thing since its full customization. Security is also better because surprisingly, XML is very simple. Because of its long lines it usually requires an expert developer.
So what now?
My personal take in this debate is that XML and JSON has their own claim to fame. Some are suggesting that JSON is the new XML in relation to Ajax. However, Ajax is one of the highly flawed programs when it comes to security. JSON might be able to answer Ajax based programs in some ways however XML could also answer some of the problems in Ajax especially when you’re talking about security and customization.
- Cheers