Thursday 3 April 2014

What is the difference between JSON and XML?

What is the difference between JSON and XML?
JSON is muck like XML.
JSON is faster and easier than XML.
XML:
-Need end tags
==>To read xml data: We have to fetch XML file and use XML DOM to loop through the file. Then extract values and stores in variables.
JSON:
-No need of end tags
-Shorter
-easy read and write
-Can be parsed using built in JavaScript eval()
-It will used arrays (So indexing will be there..)
-No reserved words
==>To read JSON:Fetch JSON string, eval() the JSON string.