Sciology = Science + Technology

Commonsense in Technology

  • Archives

  • Pictures

Archive for the ‘XML’ Category

XML vs JSON !!! Dont compare.

Posted by sureshkrishna on October 13, 2007

Java Script Object Notation (JSON) has become quite famous since 2006 and it has gone into the major companies application frameworks. JackBe, Google and Yahooare some of the companies that have adopted the JSON in their products. JSON is the response format for many kinds (rss, rest, wsdl, atom, dao, etc…) of the web service responses. Industry has already been talking “If JSON is an alternative to XML”.

I would like to keep the JSON as just a data interchange format. I would not mix up XML and JSON for the data representation and data exchange formats. Following are some differences that i have seen from my own experience…

  • XML parsing is very generic, you don’t have to care about the Types. JSON parsing on the other hand is very tricky.
  • XML has the data representation and semantics attached to it. JSON is very good for data representation.
  • Perhaps JSON data over the HTTP is faster than the XML.
  • As a developer the code to parse XML is much cleaner than the code to parse JSON.
  • Evaluating the JSON on JS is much faster and efficient. Due to its inherent support on JS, the learning cycle and manipulation of JSON data is faster than manipulation of XML by JS.
  • For WEB2.0/RIA applications, where there is frequent data transfers between the browser and server, it makes sense to get the response in JSON and manipulate it in the browser.
  • I have used XML as domain models representation. It can contain the cross references, can contain types and attach semantics with the help of Schema.
  • JSON does not have any namespaces. I am not sure if this is an added advantage for JSON.
  • JSON Does not have validator. Developer is supposed to validate what ever he gets.
  • I love the random access XML via XPath. Can i do the same thing in JSON.
  • XLink, XQuery are some of the cool things i like on the XML.
  • I can represent the entire design of a system as XMI. It has references, schema support, i can validate, etc…

In my view JSON is a great format for the internet/web applications over the browser. Its not the question of XML vs. JSON; Its the question of When XML and When JSON.

Posted in AJAX, JSON, XML | Tagged: , , | 7 Comments »

JSON2XML TreeViewer plugin for Eclipse

Posted by sureshkrishna on September 24, 2007

I have been working on the WEB2.0 platform from past one year. All the while i was looking out for simple plugins for eclipse to visualize and analyze the  json that either i built or got from server.

  • It is so much of a pain to really construct the JSON and then to debug to see if we have inserted the data at the right children.
  • When the complexity of the JSON grows, its difficult to see which are arrays and which are maps.
  • What if you need to test if the JSON is syntactically correct ? (of course we can send the request to  the server and get a response with a error header, but this is not what we want in most of cases)
  • When JSON is well formatted with the correct tabs it looks good else its a coffee-break time to see the JSON as formatted text

After looking at all these issues, i have written a small plugin to convert the JSON to XML and a Tree Response. This enables you to…

  • View the JSON as XML text
  • View JSON as Hierarchical Tree
  • Get immediate response if JSON is wrong.

I would love to get any of your feedback and response. I would be working on this plugin in the future, so your improvement request are well considered.

Posted in Eclipse, Java, JSON, Plug-ins, Plugin, TreeView, XML | 11 Comments »