JSON is Like XML

 

JSON Example

{"employees":[
{"firstName":"Adam", "lastName":"Amazing" },
{"firstName":"Mary", "lastName":"Marvelous"},{"firstName":"Peter", "lastName":"Perfection"}

]}

 

XML

<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>

 

JSON is different than XML

The biggest difference is that XML must be parsed with an XML parser. JSON can be parsed by a standard JavaScript function.

 

Why JSON is Better Than XML

 

Using XML

 

Using JSON