Thursday, February 27, 2014

JSON vs XML

 JSON Vs XML, Which one to use ?
Following are key differences between JSON & XML, which will help to decide which content format one should use in there application :

  • Parsing and Generating JSON data is easier as compared to XML.
  • JSON has simpler structure than XML.
  •  In XML document manipulation is easy as compared to JSON.You can easily find/update nodes.You have XPath/XQuery for XML, Do we have it for JSON ? 
  • You can do lots of thing with XML for example converting XML to HTML using XLST, such tools not available for JSON.
  •  XML is more rich in features and you can have more control over data and do great amount of validation as compared to JSON.You can have DTD's for XML to specify validation in details 
  • Working with JSON is simpler, especially with Javascript, just by giving call to Eval will give you Javascript Object.
  • JSON is not in a document format neither it is markup language but XML is.
  • JSON has great language support as compared to XML.
  • JSON is best for simpler use/scenario, for better security,support and validation XML is better.
  • JSON is faster as compared to XML as it is less rich, there is less overhead of tags & there is simpler validation rules.