JSON vs XML
Both XML and JSON are widely used today. They are used as data interchange formats and both have been adopted by applications as a way to store structured data.
|JSON is simple to read and write.||XML is less simple as compared to JSON.|
|JSON files are more human-readable than XML.||XML files are less human readable.|
|JSON object has a type.||XML data is typeless.|
|JSON types: string, number, array, boolean.||All XML data should be string.|
|Data is readily accessible as JSON objects.||XML data needs to be parsed.|
|JSON is supported by most browsers.||Cross-browser XML parsing can be tricky.|
|JSON has no display capabilities.||XML provides a capability to display data because it is a markup language.|
|Retrieving value is easy.||Retrieving value is difficult.|
|Supported by many Ajax toolkit.||Not fully supported by Ajax toolkit.|
|Native support for object.||The object has to be expressed by conventions - mostly missed use of attributes and elements.|
Why is JSON better than XML
XML is much more difficult to parse than JSON. It has to be parsed with an XML parser.
For AJAX applications, JSON is faster and easier than XML.