I like my old friend

 

It is an old post based on old idea, it is not relevant anymore.

 

XML VS JSON. Which one is the super-power to exchange data from server-side to client-side? This is old debate. You will find thousands article about it. Why am I writing about it?

When I was working with IBM Toronto Lab, someone asked me why I like XML. I said my reason and I have only one reason. Most of the people like JSON because of its hype and unfortunately, they did not get the opportunity to work with complex data. 

JSON is the best approach to transfer data from server-side to the client-side because JSON is lighter than XML and easy to fetch data from JavaScript. It is true only if complexity of data and business requirement are simple.

Now think about the following scenario, I am working with scheduling software where XML contains schedule of each team member. I need to send more than 1000 data from server to client side such as, RIA at a time.  The big picture of the XML is:

<company>
 <department-list>
  <team-list>
   ---------------------
  </team-list>
 </department-list>
</company>

[I am assuming, number of department are 10, teams of each department are 10, and members of each team are 10. Here, I am concerning only list type data. Obviously, in real life we have more data, like name, tile, skills, vacations etc.]

So company contains list of departments where each department contains list of teams, each team contains list of team members and each team member contains schedule data list. Schedule data list contains 5/7 days schedule of each team member. Now it is not so easy to produce JSON string according to this business requirement. JSON will produce a number of brackets (), {} [] because of chain list of objects. JSON's brackets will be more shocking than angle brackets <> of XML. Too many brackets of JSON generate terrible maintenance procedure in the future.

XML might be verbose than JSON, but XML is easy to follow, easy to debug, easy to parsing, and easy to modify according to the business needs because of its simple structure. According to my point of view, XML is the best where large amount of data need to be sent from server to client at a time. So I like my old friend XML very much.

Comments

Popular posts from this blog

There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server; ERROR

How to install Homebrew in Mac OSX (High Sierra)

WildFly 19 and Log4J2