Wednesday, 19 August 2015

JSON Vs XML



  JSON

JSON : “JavaScript Object Notation”.

XML

XML: “Extensible Markup Language”.
 Extended FromJSON is extended from JavaScript.XML is extended from SGML : “Standard Generalized Markup Language“.
 Purpose JSON is one type of text-based format or standard for interchanging  data i.e.human readable.  JSON is developed by “Douglas Crockford”. XML is a Markup Language having format that contains set of rules for the encoding the documents which is readable for bothhuman & machine. XML is developed by W3C :“World Wide Web Consortium “.
 Syntax JSON syntax is lighter than XML as JSON has serialized format of data having  less redundancy. JSON does not contain start and end tags. XML is not so lighter as JSON as having start and end tags and it takes more character than JSON to represent same data.
SpeedJSON is light – weighted in compare to XML as it has serialized format and so faster also.XML is not so light weighted as JSON.
Support of Data Type & ArrayJSON supports datatype including integer and strings, JSON also supports array.XML does not provide any data type so needs to be parsed into particular datatype. No direct support for array also.
Object SupportJSON has support of native objects.XML can get support of objects through mixed use of attributes & elements.
CommentsJSON does not support CommentsXML supports comments.
NamespaceJSON does not have support for Namespaces.XML supports Namespaces.
MappingJSON is data oriented and can be mapped more easily.XML is document oriented and needs more effort formapping.
ParsingJSON uses only evel() for parsing i.e. for interpreting the JavaScript code & returns the result. It does not need any additional code for parsing.XML needs XML Document Object Model (DOM) implementation & with that additional code for mapping text back to the JavaScript objects.
ApplicationFor Web services, JSON is better.For configuration, XML is better.
Changing FormatYou can not change JSON data to otherformat.In XML, using XSLT you can change XML data into another format like comma –delimited, plain text, JSON, etc.
AccessIn JSON no such is 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.

No comments:

Post a Comment