Sunday, 24 April 2016

JSON vs. XML


JSON is much more light-weight than XML.
JSON support usage of arrays which is not available in XML.


JSON example
{"employees":[
   {"empId":"143011", "name":"Shaan", "city":"Jhansi"},
   {"empId":"143012", "name":"Rahul", "city":"Agra"},
   {"empId":"143013", "name":"Jatin", "city":"Paris"},

]}

XML example
<employees>
  <employee>
    <empId>143011</empId>
    <name>Shaan</name>
    <city>Jhansi</city>
  </employee>
  <employee>
    <empId>143012</empId>
    <name>Rahul</name>
    <city>Agra</city>
  </employee>
  <employee>
    <empId>143013</empId>
    <name>Jatin</name>
    <city>Paris</city>
  </employee>
</employees>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.