{
"employees": [
{
"firstName": "David",
"lastName": "Fernandas"
},
{
"firstName": "Clara",
"lastName": "James"
},
{
"firstName": "Katie",
"lastName": "Elizibeth"
}
]
}
<employees>
<employee>
<firstName>David</firstName> <lastName>Fernandas</lastName>
</employee>
<employee>
<firstName>Clara</firstName> <lastName>James</lastName>
</employee>
<employee>
<firstName>Katie</firstName> <lastName>Elizibeth</lastName>
</employee>
</employees>
XML | JSON |
---|---|
XML stands for Extensible Markup Language. | JSON stands for JavaScript Object Notation. |
XML is extensible. We can define new tags or attributes to represent data in it. | JSON is not extensible because it is not a document markup language. |
XML is object-oriented Actually, XML is document-oriented. | JSON is data-oriented. JSON can be mapped more easily to object-oriented systems. |
XML separates the presentation of data from the structure of that data. XML requires translating the structure of the data into a document structure. This mapping can be complicated. XML structures are based on elements (which can be nested), attributes (which cannot), raw content text, entities, DTDs, and other meta structures. | JSON structures are based on arrays and records. That is what data is made of. |
XML documents can contain any imaginable data type - from classical data like text and numbers, or multimedia objects such as sounds, to active formats like Java applets or ActiveX components. | JSON does not have a <[CDATA[]]> feature, so it is not well suited to act as a carrier of sounds or images or other large binary payloads. JSON is optimized for data. Besides, delivering executable programs in a data-interchange system could introduce dangerous security problems. |
XML provides the display capabilities. | JSON does not provide any display capabilities because it is not a document markup language. |
XML is secured | JSON is less secured than XML. |
XML has to be parsed with an XML parser. | JSON can be parsed by a standard JavaScript function. |