Extensible Markup language.
Doesn't support for Namespace
Support for Namespace
Doesn't support for comments
Support for comments
Cant convert to another format
Can convert to another format using XSLT
Its light-weighted because serialized format and so faster compare to XML
It's not light-weighted Compare to JSON because its can have more character for same using in JSON
Its support data type include int,string and array also
It's doesn't support for data type ,so we go for parsed into particular data type.
Its text-based format
Its text-based format but having some set rules for encoding
Its better Usage for web service
Its better Usage for web configuration
Its Data oriented and easily mapped
Its Document oriented and not that much easily to mapping
No need to use start and end tag
Need to use start and end tag
The JSON.parse() method parses a string as JSON, optionally transforming the value produced by parsing.
string to parse as JSON
prescribes how the value originally produced by parsing is transformed, before being returned
JSON.parse('"foo"'); // "foo"
JSON.parse('[1, 5, "false"]'); // [1, 5, "false"]
Sample Code JSON :
Sample Code XML:
//< SalesPerson >
// < SalesPerson >
//<\ SalesPerson >
/// < SalesPerson >
/// <\ SalesPerson >
// <\ SalesPerson >
Its not such a interface for getting direct access to a part in JSON data-structure
In XML, Using XPath, it is possible to get the direct access to a particular part of multiple parts of XML data- structure.
Using above xml sample code :
var document = new XPathDocument(@"sample.xml");
var navigator = document.CreateNavigator();
var books = navigator.Select("/SalesPerson/SalesPerson/name");