Return to Snippet

Revision: 43646
at March 28, 2011 22:13 by kashif21

Initial Code
Both XML and JSON use structured approaches to mark up data. For example, an address book application might provide a Web service that yields address cards in this XML format:

<?xml version='1.0' encoding='UTF-8'?>
   <fullname>Sean Kelly</fullname>
   <org>SK Consulting</org>
      <address type='work'>[email protected]</address>
      <address type='home' pref='1'>[email protected]</address>
      <tel type='work' pref='1'>+1 214 555 1212</tel>
      <tel type='fax'>+1 214 555 1213</tel>
      <tel type='mobile'>+1 214 555 1214</tel>
      <address type='work' format='us'>1234 Main St
         Springfield, TX 78080-1216</address>
      <address type='home' format='us'>5678 Main St
         Springfield, TX 78080-1316</address>
      <address type='work'></address>
      <address type='home'></address>

////////////////////////JSON /////////////////////////////////////////////

   "fullname": "Sean Kelly",
   "org": "SK Consulting",
   "emailaddrs": [
      {"type": "work", "value": "[email protected]"},
      {"type": "home", "pref": 1, "value": "[email protected]"}
    "telephones": [
      {"type": "work", "pref": 1, "value": "+1 214 555 1212"},
      {"type": "fax", "value": "+1 214 555 1213"},
      {"type": "mobile", "value": "+1 214 555 1214"}
   "addresses": [
      {"type": "work", "format": "us",
       "value": "1234 Main StnSpringfield, TX 78080-1216"},
      {"type": "home", "format": "us",
       "value": "5678 Main StnSpringfield, TX 78080-1316"}
    "urls": [
      {"type": "work", "value": ""},
      {"type": "home", "value": ""}

Initial URL

Initial Description

Initial Title
Json VS  XML syntax

Initial Tags
xml, json

Initial Language