XML vs JSON

20 views
Skip to first unread message

Shailendra shail

unread,
Dec 4, 2010, 1:00:19 PM12/4/10
to Technical Discussion
Can any one tell why should we use XML while it take more space than
JSON? Any advantage or disadvantage?

Nishant Gupta

unread,
Dec 5, 2010, 10:33:35 PM12/5/10
to newidea_or...@googlegroups.com
Its not that we "should" use XML. You are right when you say that XML involves more time/resource when it comes to serializing/deserializing/parsing of XML, whereas JSON is fast. Therefore, nowadays, almost all Web Apps are using JSON.

However, XML still remains to be used because of the following reasons-

a) XML was formed before JSON, and many applications were written with XML in mind. Therefore, to act with legacy apps, we are forced to use XML sometimes.

b) JSON parsing is a potential security threat to Web-Apps where the in-built Javascript interpreter actually executes the JSON object. XML on the other hand cannot be "executed".

c) JSON can be used only in web-apps/apps involving the browser, because Javascript can inherently understand JSON. If we use JSON as Data Exchange mechanism in Desktop Apps, then again, we'll have to use separate parsers to parse the JSON, which is same as parsing XML.

d) JSON is good when the complexity/hierarchy of data being commuted is low. For Highly complex data or data involving complex hierarchies, JSON becomes difficult to parse/manage. There, we should use XML.

e) Mainframes run REXX/COBOL. Whatever we do is ultimately processed by a Mainframe sitting somewhere. The Interface between all kinds of languages and COBOL/REXX is only XML ( for legacy reasons).

SO, we cannot ( and should not ) do away with XML. Both XML and JSON have their separate fields of application based upon convenience.

Inviting any comments/suggestions/corrections...

Thanks & Regards,

Nishant Gupta,
 APPLE - Developer (TCS Offshore)
neo324893 @ AIM
+91 9342420245, 9620779208

Shailendra shail

unread,
Dec 11, 2010, 2:13:13 PM12/11/10
to newidea_or...@googlegroups.com
This is correct.. (Good)

Shailendra shail

unread,
Dec 11, 2010, 2:18:31 PM12/11/10
to newidea_or...@googlegroups.com
SON and XML are the two programs that have been lovingly adapted to JavaScript to create Rich Internet Applications. JSON stands for JavaScript Object Notation. Considered as the subset of JavaScript, the “application” has been launched in 1999 and since then it has slowly created a buzz in complimenting JavaScript. XML on the other hand is a mark-up language that could be used in different languages. That mean it can easily adapt to any languages such as JavaScript.

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

Shailendra shail

unread,
Jul 11, 2012, 1:26:12 PM7/11/12
to newidea_or...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages