Difference Between JSON vs XML

Difference between JSON(Java Script Object Notation) and XML(eXtensible Markup Language). The major difference between are as follows.

No. JSON XML
1) JSON stands for JavaScript Object Notation. XML stands for eXtensible Markup Language.
2) JSON is simple to read and write. XML is less simple than JSON.
3) JSON is easy to learn. XML is less easy than JSON.
4) JSON is data-oriented. XML is document-oriented.
5) JSON doesn’t provide display capabilities. XML provides the capability to display data because it is a markup language.
6) JSON supports array. XML doesn’t support array.
7) JSON is less secured than XML. XML is more secured.
8) JSON files are more human readable than XML. XML files are less human readable.
9) JSON supports only text and number data type. XML support many data types such as text, number, images, charts, graphs etc. Moreover, XML offeres options for transferring the format or structure of the data with actual data.

JSON Example

{“employees”:[
{ “firstName”:”John”, “lastName”:”Doe” },
{ “firstName”:”Anna”, “lastName”:”Smith” },
{ “firstName”:”Peter”, “lastName”:”Jones” }
]}

XML Example

<employees>
<employee>
<firstName>John</firstName> <lastName>Doe</lastName>
</employee>
<employee>
<firstName>Anna</firstName> <lastName>Smith</lastName>
</employee>
<employee>
<firstName>Peter</firstName> <lastName>Jones</lastName>
</employee>
</employees>